Skip to content

Commit 1095fd5

Browse files
lwesierssys_zuul
authored andcommitted
Fix building with getCalledValue for LLVM11.
Change-Id: I36d6ee34344e74a2ceb8a596f6d966eac4e9e962
1 parent ba47b5c commit 1095fd5

File tree

15 files changed

+61
-20
lines changed

15 files changed

+61
-20
lines changed

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3535
#include <llvm/IR/Module.h>
3636
#include <llvmWrapper/IR/Function.h>
3737
#include <llvmWrapper/ADT/STLExtras.h>
38+
#include <llvmWrapper/IR/Instructions.h>
3839
#include <llvm/IR/Instructions.h>
3940
#include <llvm/IR/DerivedTypes.h>
4041
#include "llvm/IR/DIBuilder.h"
@@ -362,7 +363,7 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
362363

363364
if (IGC_IS_FLAG_ENABLED(EnableFunctionPointer))
364365
{
365-
if (!cInst || cInst->getCalledValue() != old_func)
366+
if (!cInst || IGCLLVM::getCalledValue(cInst) != old_func)
366367
{
367368
// Support indirect function pointer usages
368369
if (Instruction* userInst = dyn_cast<Instruction>(U))

IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
#include "Compiler/CodeGenPublic.h"
3232
#include "common/LLVMWarningsPush.hpp"
3333
#include "llvmWrapper/IR/DerivedTypes.h"
34+
#include <llvmWrapper/IR/Instructions.h>
3435
#include <llvm/IR/Module.h>
3536
#include <llvm/IR/Function.h>
3637
#include "llvm/IR/InstIterator.h"
@@ -410,7 +411,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(CallInst* callInst)
410411
}
411412
Type* retType = returnPtr ? Type::getVoidTy(callInst->getContext()) : callInst->getType();
412413
FunctionType* newFnTy = FunctionType::get(retType, argTypes, false);
413-
Value* calledValue = callInst->getCalledValue();
414+
Value* calledValue = IGCLLVM::getCalledValue(callInst);
414415
newCalledValue = m_pBuilder->CreatePointerCast(calledValue, PointerType::get(newFnTy, 0));
415416
}
416417
else

IGC/AdaptorCommon/ProcessFuncAttributes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3636
#include "common/LLVMWarningsPush.hpp"
3737

3838
#include "llvmWrapper/IR/Attributes.h"
39+
#include "llvmWrapper/IR/Instructions.h"
3940

4041
#include <llvm/Pass.h>
4142
#include <llvm/IR/Module.h>
@@ -351,7 +352,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
351352
{
352353
CallInst* call = dyn_cast<CallInst>(*u);
353354

354-
if (!call || call->getCalledValue() != F)
355+
if (!call || IGCLLVM::getCalledValue(call) != F)
355356
{
356357
isIndirect = true;
357358
}

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5151
#include "GenISAIntrinsics/GenIntrinsicInst.h"
5252
#include "Compiler/IGCPassSupport.h"
5353
#include "common/LLVMWarningsPush.hpp"
54+
#include "llvmWrapper/IR/Instructions.h"
5455
#include "llvm/Support/Path.h"
5556
#include "llvmWrapper/IR/Intrinsics.h"
5657
#include "common/LLVMWarningsPop.hpp"
@@ -239,7 +240,7 @@ uint EmitPass::DecideInstanceAndSlice(llvm::BasicBlock& blk, SDAG& sdag, bool& s
239240
if (CallInst * callInst = dyn_cast<CallInst>(sdag.m_root))
240241
{
241242
// Disable slicing for function calls
242-
Function* F = dyn_cast<Function>(callInst->getCalledValue());
243+
Function* F = dyn_cast<Function>(IGCLLVM::getCalledValue(callInst));
243244
if (!F || F->hasFnAttribute("visaStackCall"))
244245
{
245246
numInstance = 1;
@@ -8204,7 +8205,7 @@ void EmitPass::EmitIntrinsicMessage(llvm::IntrinsicInst* inst)
82048205
bool EmitPass::validateInlineAsmConstraints(llvm::CallInst* inst, SmallVector<StringRef, 8> & constraints)
82058206
{
82068207
IGC_ASSERT(inst->isInlineAsm());
8207-
InlineAsm* IA = cast<InlineAsm>(inst->getCalledValue());
8208+
InlineAsm* IA = cast<InlineAsm>(IGCLLVM::getCalledValue(inst));
82088209
StringRef constraintStr(IA->getConstraintString());
82098210
if (constraintStr.empty()) return true;
82108211

@@ -8277,7 +8278,7 @@ bool EmitPass::validateInlineAsmConstraints(llvm::CallInst* inst, SmallVector<St
82778278
void EmitPass::EmitInlineAsm(llvm::CallInst* inst)
82788279
{
82798280
std::stringstream& str = m_encoder->GetVISABuilder()->GetAsmTextStream();
8280-
InlineAsm* IA = cast<InlineAsm>(inst->getCalledValue());
8281+
InlineAsm* IA = cast<InlineAsm>(IGCLLVM::getCalledValue(inst));
82818282
string asmStr = IA->getAsmString();
82828283
smallvector<CVariable*, 8> opnds;
82838284
SmallVector<StringRef, 8> constraints;
@@ -9874,7 +9875,7 @@ void EmitPass::emitStackCall(llvm::CallInst* inst)
98749875
}
98759876
};
98769877

9877-
CVariable* funcAddr = GetSymbol(inst->getCalledValue());
9878+
CVariable* funcAddr = GetSymbol(IGCLLVM::getCalledValue(inst));
98789879
if (!isIndirectFCall)
98799880
{
98809881
CopyArgBlkVariables();

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3535
#include <llvm/IR/Constants.h>
3636
#include <llvm/IR/Instruction.h>
3737
#include <llvm/IR/PatternMatch.h>
38+
#include <llvmWrapper/IR/Instructions.h>
3839
#include "common/LLVMWarningsPop.hpp"
3940
#include "GenISAIntrinsics/GenIntrinsicInst.h"
4041
#include "Compiler/IGCPassSupport.h"
@@ -2993,7 +2994,7 @@ namespace IGC
29932994
// Mark the function pointer in indirect calls as a source
29942995
if (!callinst->getCalledFunction())
29952996
{
2996-
MarkAsSource(callinst->getCalledValue());
2997+
MarkAsSource(IGCLLVM::getCalledValue(callinst));
29972998
}
29982999
}
29993000
AddPattern(pattern);

IGC/Compiler/Optimizer/BuiltInFuncImport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
#include "common/LLVMWarningsPush.hpp"
3232
#include "llvmWrapper/IR/Attributes.h"
3333
#include <llvmWrapper/IR/Function.h>
34+
#include <llvmWrapper/IR/Instructions.h>
3435
#include <llvm/IR/CallSite.h>
3536
#include <llvm/IR/Module.h>
3637
#include <llvm/IR/Instruction.h>
@@ -691,7 +692,7 @@ void BIImport::removeFunctionBitcasts(Module& M)
691692
{
692693
CallInst* pInstCall = dyn_cast<CallInst>(I);
693694
if (!pInstCall || pInstCall->getCalledFunction()) continue;
694-
if (auto constExpr = dyn_cast<llvm::ConstantExpr>(pInstCall->getCalledValue()))
695+
if (auto constExpr = dyn_cast<llvm::ConstantExpr>(IGCLLVM::getCalledValue(pInstCall)))
695696
{
696697
if (auto funcTobeChanged = dyn_cast<llvm::Function>(constExpr->stripPointerCasts()))
697698
{

IGC/Compiler/Optimizer/IndirectCallOptimization.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2929
#include "Compiler/CodeGenPublic.h"
3030
#include "common/IGCIRBuilder.h"
3131
#include "common/LLVMWarningsPush.hpp"
32+
#include <llvmWrapper/IR/Instructions.h>
3233
#include <llvm/IR/Function.h>
3334
#include <llvm/IR/InstIterator.h>
3435
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
@@ -173,7 +174,7 @@ namespace IGC
173174
IGCIRBuilder<> IRB(pModule->getContext());
174175
IRB.SetInsertPoint(&CI);
175176

176-
Value* calledAddr = IRB.CreatePtrToInt(CI.getCalledValue(), IRB.getInt64Ty());
177+
Value* calledAddr = IRB.CreatePtrToInt(IGCLLVM::getCalledValue(CI), IRB.getInt64Ty());
177178

178179
BasicBlock* beginBlock = CI.getParent();
179180
BasicBlock* endBlock = beginBlock->splitBasicBlock(&CI, "endIndirectCallBB");

IGC/ElfPackager/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4848
#include "llvm/Support/SourceMgr.h"
4949
#include "llvm/Support/CommandLine.h"
5050

51+
#include "llvmWrapper/IR/Instructions.h"
5152
#include "llvmWrapper/IR/Module.h"
5253
#include "llvmWrapper/ADT/STLExtras.h"
5354

@@ -161,7 +162,7 @@ std::unique_ptr<IGCLLVM::Module> LocalCloneModule(
161162
auto inst = &*UI_BB;
162163
if (auto CI = dyn_cast<CallInst>(inst))
163164
{
164-
auto val = CI->getCalledValue();
165+
auto val = IGCLLVM::getCalledValue(CI);
165166
auto *I2 = dyn_cast<llvm::Function>(val->stripPointerCasts());
166167

167168
Function *NF2 = cast<Function>(New.get()->getOrInsertFunction(

IGC/VectorCompiler/lib/GenXCodeGen/GenXCategory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
144144
#include "GenXTargetMachine.h"
145145
#include "GenXUtil.h"
146146
#include "llvmWrapper/IR/InstrTypes.h"
147+
#include "llvmWrapper/IR/Instructions.h"
147148
#include "vc/GenXOpts/Utils/KernelInfo.h"
148149
#include "vc/GenXOpts/Utils/RegCategory.h"
149150
#include "llvm/ADT/PostOrderIterator.h"
@@ -878,7 +879,7 @@ unsigned GenXCategory::getCategoryForInlasmConstraintedOp(CallInst *CI,
878879
unsigned ArgNo,
879880
bool IsOutput) const {
880881
IGC_ASSERT(CI->isInlineAsm() && "Inline asm expected");
881-
InlineAsm *IA = dyn_cast<InlineAsm>(CI->getCalledValue());
882+
InlineAsm *IA = dyn_cast<InlineAsm>(IGCLLVM::getCalledValue(CI));
882883
IGC_ASSERT(!IA->getConstraintString().empty() && "Here should be constraints");
883884

884885
auto ConstraintsInfo = genx::getGenXInlineAsmInfo(CI);

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7777
#include "llvm/Support/ScopedPrinter.h"
7878
#include "llvm/Support/StringSaver.h"
7979

80+
#include "llvmWrapper/IR/Instructions.h"
8081
#include "llvmWrapper/IR/InstrTypes.h"
8182

8283
#include <map>
@@ -4556,7 +4557,7 @@ unsigned GenXKernelBuilder::getOrCreateLabel(Value *V, int Kind) {
45564557

45574558
void GenXKernelBuilder::buildInlineAsm(CallInst *CI) {
45584559
IGC_ASSERT(CI->isInlineAsm() && "Inline asm expected");
4559-
InlineAsm *IA = dyn_cast<InlineAsm>(CI->getCalledValue());
4560+
InlineAsm *IA = dyn_cast<InlineAsm>(IGCLLVM::getCalledValue(CI));
45604561
std::string AsmStr(IA->getAsmString());
45614562
std::stringstream &AsmTextStream = CisaBuilder->GetAsmTextStream();
45624563

@@ -5555,7 +5556,7 @@ void GenXKernelBuilder::buildStackCall(IGCLLVM::CallInst *CI,
55555556
Pred, (NoMask ? vISA_EMASK_M1_NM : vISA_EMASK_M1), EXEC_SIZE_16,
55565557
Callee->getName(), NoStackSize, RetSize));
55575558
} else {
5558-
auto *FuncAddr = createSource(CI->getCalledValue(), DONTCARESIGNED);
5559+
auto *FuncAddr = createSource(IGCLLVM::getCalledValue(CI), DONTCARESIGNED);
55595560
IGC_ASSERT(FuncAddr);
55605561
CISA_CALL(Kernel->AppendVISACFIndirectFuncCallInst(
55615562
Pred, (NoMask ? vISA_EMASK_M1_NM : vISA_EMASK_M1), EXEC_SIZE_16,

0 commit comments

Comments
 (0)