Skip to content

Commit 36f4bd1

Browse files
lwesiersigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: e9cac19
Bugfix in IGC Metrics Fix crash in ResolveGAS
1 parent e6c9f8e commit 36f4bd1

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

IGC/Compiler/CISACodeGen/ResolveGAS.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ SPDX-License-Identifier: MIT
1111
#include "Compiler/CISACodeGen/CastToGASAnalysis.h"
1212
#include "Compiler/CodeGenContextWrapper.hpp"
1313
#include "Compiler/MetaDataUtilsWrapper.h"
14-
#include "Metrics/IGCMetric.h"
1514
#include "Compiler/IGCPassSupport.h"
1615
#include "WrapperLLVM/Utils.h"
1716
#include "llvm/ADT/PostOrderIterator.h"
@@ -1345,7 +1344,6 @@ namespace IGC
13451344
void updateMetadata(Function* oldFunc, Function* newFunc);
13461345
Function* createFuncWithLoweredArgs(Function* F, GenericPointerArgs& argsInfo);
13471346
std::vector<Function*> findCandidates(CallGraph& CG);
1348-
void replaceValueInDbgInfoIntrinsic(llvm::Value* Old, llvm::Value* New, llvm::Module& M);
13491347
};
13501348
} // End anonymous namespace
13511349

@@ -1631,7 +1629,7 @@ void LowerGPCallArg::updateFunctionArgs(Function* oldFunc, Function* newFunc)
16311629
// used to directly update uses in metadata node. In case of GAS, RAUW asserts because
16321630
// addrspace used in Old/New values are different and this is interpreted as different
16331631
// types by LLVM and RAUW on different types is forbidden.
1634-
void LowerGPCallArg::replaceValueInDbgInfoIntrinsic(llvm::Value* Old, llvm::Value* New, llvm::Module& M)
1632+
void replaceValueInDbgInfoIntrinsic(llvm::Value* Old, llvm::Value* New, llvm::Module& M)
16351633
{
16361634
if (Old->isUsedByMetadata())
16371635
{
@@ -1640,10 +1638,10 @@ void LowerGPCallArg::replaceValueInDbgInfoIntrinsic(llvm::Value* Old, llvm::Valu
16401638
if (addrSpaceMD)
16411639
{
16421640
llvm::DIBuilder DIB(M);
1643-
std::vector<llvm::Instruction*> instToDelete;
1641+
std::vector<llvm::DbgInfoIntrinsic*> DbgInfoInstToDelete;
16441642
for (auto* User : addrSpaceMD->users())
16451643
{
1646-
if (isa<DbgInfoIntrinsic>(User))
1644+
if (cast<DbgInfoIntrinsic>(User))
16471645
{
16481646
//User->dump();
16491647
if (auto DbgV = cast<DbgValueInst>(User))
@@ -1658,26 +1656,12 @@ void LowerGPCallArg::replaceValueInDbgInfoIntrinsic(llvm::Value* Old, llvm::Valu
16581656
DbgD->getVariable(), DbgD->getExpression(), DbgD->getDebugLoc().get(),
16591657
cast<llvm::Instruction>(User));
16601658
}
1661-
1662-
instToDelete.push_back(cast<llvm::DbgInfoIntrinsic>(User));
1663-
}
1664-
else if (isa<CallInst>(User))
1665-
{
1666-
if (auto callInst = cast<CallInst>(User))
1667-
{
1668-
if (IGCMetrics::IGCMetric::isMetricFuncCall(
1669-
cast<CallInst>(User)))
1670-
{
1671-
m_ctx->metrics.UpdateVariable(Old, New);
1672-
}
1673-
}
1674-
1675-
instToDelete.push_back(cast<llvm::CallInst>(User));
1659+
DbgInfoInstToDelete.push_back(cast<llvm::DbgInfoIntrinsic>(User));
16761660
}
16771661
}
16781662

1679-
for (auto inst : instToDelete)
1680-
inst->eraseFromParent();
1663+
for (auto DbgInfoInst : DbgInfoInstToDelete)
1664+
DbgInfoInst->eraseFromParent();
16811665
}
16821666
}
16831667
}

0 commit comments

Comments
 (0)