diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp | 68 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPULibFunc.h | 4 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/Mips16HardFloat.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86WinEHState.cpp | 16 |
9 files changed, 71 insertions, 68 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 31a6e7e7c9f..03a3dacb76f 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -11748,12 +11748,13 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const { Type::getInt8PtrTy(M.getContext())); // MSVC CRT has a function to validate security cookie. - auto *SecurityCheckCookie = cast<Function>( - M.getOrInsertFunction("__security_check_cookie", - Type::getVoidTy(M.getContext()), - Type::getInt8PtrTy(M.getContext()))); - SecurityCheckCookie->setCallingConv(CallingConv::Win64); - SecurityCheckCookie->addAttribute(1, Attribute::AttrKind::InReg); + FunctionCallee SecurityCheckCookie = M.getOrInsertFunction( + "__security_check_cookie", Type::getVoidTy(M.getContext()), + Type::getInt8PtrTy(M.getContext())); + if (Function *F = dyn_cast<Function>(SecurityCheckCookie.getCallee())) { + F->setCallingConv(CallingConv::Win64); + F->addAttribute(1, Attribute::AttrKind::InReg); + } return; } TargetLowering::insertSSPDeclarations(M); diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp index 1fbaae2ba33..f259f8311ec 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp @@ -72,7 +72,7 @@ private: // Return a pointer (pointer expr) to the function if function defintion with // "FuncName" exists. It may create a new function prototype in pre-link mode. - Constant *getFunction(Module *M, const FuncInfo& fInfo); + FunctionCallee getFunction(Module *M, const FuncInfo &fInfo); // Replace a normal function with its native version. bool replaceWithNative(CallInst *CI, const FuncInfo &FInfo); @@ -139,7 +139,7 @@ private: // Insert an Alloc instruction. AllocaInst* insertAlloca(CallInst * UI, IRBuilder<> &B, const char *prefix); // Get a scalar native builtin signle argument FP function - Constant* getNativeFunction(Module* M, const FuncInfo &FInfo); + FunctionCallee getNativeFunction(Module *M, const FuncInfo &FInfo); protected: CallInst *CI; @@ -216,19 +216,19 @@ INITIALIZE_PASS(AMDGPUUseNativeCalls, "amdgpu-usenative", false, false) template <typename IRB> -static CallInst *CreateCallEx(IRB &B, Value *Callee, Value *Arg, +static CallInst *CreateCallEx(IRB &B, FunctionCallee Callee, Value *Arg, const Twine &Name = "") { CallInst *R = B.CreateCall(Callee, Arg, Name); - if (Function* F = dyn_cast<Function>(Callee)) + if (Function *F = dyn_cast<Function>(Callee.getCallee())) R->setCallingConv(F->getCallingConv()); return R; } template <typename IRB> -static CallInst *CreateCallEx2(IRB &B, Value *Callee, Value *Arg1, Value *Arg2, - const Twine &Name = "") { +static CallInst *CreateCallEx2(IRB &B, FunctionCallee Callee, Value *Arg1, + Value *Arg2, const Twine &Name = "") { CallInst *R = B.CreateCall(Callee, {Arg1, Arg2}, Name); - if (Function* F = dyn_cast<Function>(Callee)) + if (Function *F = dyn_cast<Function>(Callee.getCallee())) R->setCallingConv(F->getCallingConv()); return R; } @@ -471,7 +471,7 @@ static inline AMDGPULibFunc::EType getArgType(const AMDGPULibFunc& FInfo) { return (AMDGPULibFunc::EType)FInfo.getLeads()[0].ArgType; } -Constant *AMDGPULibCalls::getFunction(Module *M, const FuncInfo& fInfo) { +FunctionCallee AMDGPULibCalls::getFunction(Module *M, const FuncInfo &fInfo) { // If we are doing PreLinkOpt, the function is external. So it is safe to // use getOrInsertFunction() at this stage. @@ -518,11 +518,11 @@ bool AMDGPULibCalls::sincosUseNative(CallInst *aCI, const FuncInfo &FInfo) { nf.setPrefix(AMDGPULibFunc::NATIVE); nf.setId(AMDGPULibFunc::EI_SIN); - Constant *sinExpr = getFunction(M, nf); + FunctionCallee sinExpr = getFunction(M, nf); nf.setPrefix(AMDGPULibFunc::NATIVE); nf.setId(AMDGPULibFunc::EI_COS); - Constant *cosExpr = getFunction(M, nf); + FunctionCallee cosExpr = getFunction(M, nf); if (sinExpr && cosExpr) { Value *sinval = CallInst::Create(sinExpr, opr0, "splitsin", aCI); Value *cosval = CallInst::Create(cosExpr, opr0, "splitcos", aCI); @@ -554,7 +554,7 @@ bool AMDGPULibCalls::useNative(CallInst *aCI) { return sincosUseNative(aCI, FInfo); FInfo.setPrefix(AMDGPULibFunc::NATIVE); - Constant *F = getFunction(aCI->getModule(), FInfo); + FunctionCallee F = getFunction(aCI->getModule(), FInfo); if (!F) return false; @@ -612,7 +612,7 @@ bool AMDGPULibCalls::fold_read_write_pipe(CallInst *CI, IRBuilder<> &B, auto *FTy = FunctionType::get(Callee->getReturnType(), ArrayRef<Type *>(ArgTys), false); AMDGPULibFunc NewLibFunc(Name, FTy); - auto *F = AMDGPULibFunc::getOrInsertFunction(M, NewLibFunc); + FunctionCallee F = AMDGPULibFunc::getOrInsertFunction(M, NewLibFunc); if (!F) return false; @@ -794,7 +794,7 @@ bool AMDGPULibCalls::replaceWithNative(CallInst *CI, const FuncInfo &FInfo) { AMDGPULibFunc nf = FInfo; nf.setPrefix(AMDGPULibFunc::NATIVE); - if (Constant *FPExpr = getFunction(M, nf)) { + if (FunctionCallee FPExpr = getFunction(M, nf)) { LLVM_DEBUG(dbgs() << "AMDIC: " << *CI << " ---> "); CI->setCalledFunction(FPExpr); @@ -933,9 +933,10 @@ bool AMDGPULibCalls::fold_pow(CallInst *CI, IRBuilder<> &B, if (CF && (CF->isExactlyValue(0.5) || CF->isExactlyValue(-0.5))) { // pow[r](x, [-]0.5) = sqrt(x) bool issqrt = CF->isExactlyValue(0.5); - if (Constant *FPExpr = getFunction(M, - AMDGPULibFunc(issqrt ? AMDGPULibFunc::EI_SQRT - : AMDGPULibFunc::EI_RSQRT, FInfo))) { + if (FunctionCallee FPExpr = + getFunction(M, AMDGPULibFunc(issqrt ? AMDGPULibFunc::EI_SQRT + : AMDGPULibFunc::EI_RSQRT, + FInfo))) { LLVM_DEBUG(errs() << "AMDIC: " << *CI << " ---> " << FInfo.getName().c_str() << "(" << *opr0 << ")\n"); Value *nval = CreateCallEx(B,FPExpr, opr0, issqrt ? "__pow2sqrt" @@ -1002,8 +1003,8 @@ bool AMDGPULibCalls::fold_pow(CallInst *CI, IRBuilder<> &B, // powr ---> exp2(y * log2(x)) // pown/pow ---> powr(fabs(x), y) | (x & ((int)y << 31)) - Constant *ExpExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_EXP2, - FInfo)); + FunctionCallee ExpExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_EXP2, FInfo)); if (!ExpExpr) return false; @@ -1089,8 +1090,8 @@ bool AMDGPULibCalls::fold_pow(CallInst *CI, IRBuilder<> &B, Value *nval; if (needabs) { - Constant *AbsExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_FABS, - FInfo)); + FunctionCallee AbsExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_FABS, FInfo)); if (!AbsExpr) return false; nval = CreateCallEx(B, AbsExpr, opr0, "__fabs"); @@ -1098,8 +1099,8 @@ bool AMDGPULibCalls::fold_pow(CallInst *CI, IRBuilder<> &B, nval = cnval ? cnval : opr0; } if (needlog) { - Constant *LogExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_LOG2, - FInfo)); + FunctionCallee LogExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_LOG2, FInfo)); if (!LogExpr) return false; nval = CreateCallEx(B,LogExpr, nval, "__log2"); @@ -1158,8 +1159,8 @@ bool AMDGPULibCalls::fold_rootn(CallInst *CI, IRBuilder<> &B, std::vector<const Type*> ParamsTys; ParamsTys.push_back(opr0->getType()); Module *M = CI->getModule(); - if (Constant *FPExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, - FInfo))) { + if (FunctionCallee FPExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, FInfo))) { LLVM_DEBUG(errs() << "AMDIC: " << *CI << " ---> sqrt(" << *opr0 << ")\n"); Value *nval = CreateCallEx(B,FPExpr, opr0, "__rootn2sqrt"); replaceCall(nval); @@ -1167,8 +1168,8 @@ bool AMDGPULibCalls::fold_rootn(CallInst *CI, IRBuilder<> &B, } } else if (ci_opr1 == 3) { // rootn(x, 3) = cbrt(x) Module *M = CI->getModule(); - if (Constant *FPExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_CBRT, - FInfo))) { + if (FunctionCallee FPExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_CBRT, FInfo))) { LLVM_DEBUG(errs() << "AMDIC: " << *CI << " ---> cbrt(" << *opr0 << ")\n"); Value *nval = CreateCallEx(B,FPExpr, opr0, "__rootn2cbrt"); replaceCall(nval); @@ -1185,8 +1186,8 @@ bool AMDGPULibCalls::fold_rootn(CallInst *CI, IRBuilder<> &B, std::vector<const Type*> ParamsTys; ParamsTys.push_back(opr0->getType()); Module *M = CI->getModule(); - if (Constant *FPExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_RSQRT, - FInfo))) { + if (FunctionCallee FPExpr = + getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_RSQRT, FInfo))) { LLVM_DEBUG(errs() << "AMDIC: " << *CI << " ---> rsqrt(" << *opr0 << ")\n"); Value *nval = CreateCallEx(B,FPExpr, opr0, "__rootn2rsqrt"); @@ -1242,7 +1243,8 @@ bool AMDGPULibCalls::fold_fma_mad(CallInst *CI, IRBuilder<> &B, } // Get a scalar native builtin signle argument FP function -Constant* AMDGPULibCalls::getNativeFunction(Module* M, const FuncInfo& FInfo) { +FunctionCallee AMDGPULibCalls::getNativeFunction(Module *M, + const FuncInfo &FInfo) { if (getArgType(FInfo) == AMDGPULibFunc::F64 || !HasNative(FInfo.getId())) return nullptr; FuncInfo nf = FInfo; @@ -1255,8 +1257,8 @@ bool AMDGPULibCalls::fold_sqrt(CallInst *CI, IRBuilder<> &B, const FuncInfo &FInfo) { if (getArgType(FInfo) == AMDGPULibFunc::F32 && (getVecSize(FInfo) == 1) && (FInfo.getPrefix() != AMDGPULibFunc::NATIVE)) { - if (Constant *FPExpr = getNativeFunction( - CI->getModule(), AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, FInfo))) { + if (FunctionCallee FPExpr = getNativeFunction( + CI->getModule(), AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, FInfo))) { Value *opr0 = CI->getArgOperand(0); LLVM_DEBUG(errs() << "AMDIC: " << *CI << " ---> " << "sqrt(" << *opr0 << ")\n"); @@ -1333,7 +1335,7 @@ bool AMDGPULibCalls::fold_sincos(CallInst *CI, IRBuilder<> &B, // function. AMDGPULibFunc nf(AMDGPULibFunc::EI_SINCOS, fInfo); nf.getLeads()[0].PtrKind = AMDGPULibFunc::getEPtrKindFromAddrSpace(AMDGPUAS::FLAT_ADDRESS); - Function *Fsincos = dyn_cast_or_null<Function>(getFunction(M, nf)); + FunctionCallee Fsincos = getFunction(M, nf); if (!Fsincos) return false; BasicBlock::iterator ItOld = B.GetInsertPoint(); @@ -1341,7 +1343,7 @@ bool AMDGPULibCalls::fold_sincos(CallInst *CI, IRBuilder<> &B, B.SetInsertPoint(UI); Value *P = Alloc; - Type *PTy = Fsincos->getFunctionType()->getParamType(1); + Type *PTy = Fsincos.getFunctionType()->getParamType(1); // The allocaInst allocates the memory in private address space. This need // to be bitcasted to point to the address space of cos pointer type. // In OpenCL 2.0 this is generic, while in 1.2 that is private. diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp index 569895c25cb..09322594dc8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp @@ -960,8 +960,8 @@ Function *AMDGPULibFunc::getFunction(Module *M, const AMDGPULibFunc &fInfo) { return nullptr; } -Function *AMDGPULibFunc::getOrInsertFunction(Module *M, - const AMDGPULibFunc &fInfo) { +FunctionCallee AMDGPULibFunc::getOrInsertFunction(Module *M, + const AMDGPULibFunc &fInfo) { std::string const FuncName = fInfo.mangle(); Function *F = dyn_cast_or_null<Function>( M->getValueSymbolTable().lookup(FuncName)); @@ -987,7 +987,7 @@ Function *AMDGPULibFunc::getOrInsertFunction(Module *M, } } - Constant *C = nullptr; + FunctionCallee C; if (hasPtr) { // Do not set extra attributes for functions with pointer arguments. C = M->getOrInsertFunction(FuncName, FuncTy); @@ -1001,7 +1001,7 @@ Function *AMDGPULibFunc::getOrInsertFunction(Module *M, C = M->getOrInsertFunction(FuncName, FuncTy, Attr); } - return cast<Function>(C); + return C; } bool UnmangledFuncInfo::lookup(StringRef Name, ID &Id) { diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibFunc.h b/llvm/lib/Target/AMDGPU/AMDGPULibFunc.h index 972ccb47fc7..2354ed7df20 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULibFunc.h +++ b/llvm/lib/Target/AMDGPU/AMDGPULibFunc.h @@ -393,8 +393,8 @@ public: } static Function *getFunction(llvm::Module *M, const AMDGPULibFunc &fInfo); - static Function *getOrInsertFunction(llvm::Module *M, - const AMDGPULibFunc &fInfo); + static FunctionCallee getOrInsertFunction(llvm::Module *M, + const AMDGPULibFunc &fInfo); static bool parse(StringRef MangledName, AMDGPULibFunc &Ptr); private: diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp index 02e2c50ddf6..42cd4f6f691 100644 --- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp +++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp @@ -2253,10 +2253,8 @@ CleanupAndExit: Type *Int32PtrTy = Type::getInt32PtrTy(Ctx); Type *VoidTy = Type::getVoidTy(Ctx); Module *M = Func->getParent(); - Constant *CF = M->getOrInsertFunction(HexagonVolatileMemcpyName, VoidTy, - Int32PtrTy, Int32PtrTy, Int32Ty); - Function *Fn = cast<Function>(CF); - Fn->setLinkage(Function::ExternalLinkage); + FunctionCallee Fn = M->getOrInsertFunction( + HexagonVolatileMemcpyName, VoidTy, Int32PtrTy, Int32PtrTy, Int32Ty); const SCEV *OneS = SE->getConstant(Int32Ty, 1); const SCEV *BECount32 = SE->getTruncateOrZeroExtend(BECount, Int32Ty); diff --git a/llvm/lib/Target/Mips/Mips16HardFloat.cpp b/llvm/lib/Target/Mips/Mips16HardFloat.cpp index 1b403f6c6ac..e9a3c7ec4b1 100644 --- a/llvm/lib/Target/Mips/Mips16HardFloat.cpp +++ b/llvm/lib/Target/Mips/Mips16HardFloat.cpp @@ -414,7 +414,7 @@ static bool fixupFPReturnAndCall(Function &F, Module *M, Attribute::ReadNone); A = A.addAttribute(C, AttributeList::FunctionIndex, Attribute::NoInline); - Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T)); + FunctionCallee F = (M->getOrInsertFunction(Name, A, MyVoid, T)); CallInst::Create(F, Params, "", &I); } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) { FunctionType *FT = CI->getFunctionType(); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp index 97f62f94dde..acfe49a0043 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp @@ -109,10 +109,11 @@ bool LowerGlobalDtors::runOnModule(Module &M) { FunctionType::get(Type::getVoidTy(C), AtExitFuncArgs, /*isVarArg=*/false); - Type *AtExitArgs[] = {PointerType::get(AtExitFuncTy, 0), VoidStar, VoidStar}; - FunctionType *AtExitTy = FunctionType::get(Type::getInt32Ty(C), AtExitArgs, - /*isVarArg=*/false); - Constant *AtExit = M.getOrInsertFunction("__cxa_atexit", AtExitTy); + FunctionCallee AtExit = M.getOrInsertFunction( + "__cxa_atexit", + FunctionType::get(Type::getInt32Ty(C), + {PointerType::get(AtExitFuncTy, 0), VoidStar, VoidStar}, + /*isVarArg=*/false)); // Declare __dso_local. Constant *DsoHandle = M.getNamedValue("__dso_handle"); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 353547c0dff..cc00970569e 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -2279,12 +2279,13 @@ void X86TargetLowering::insertSSPDeclarations(Module &M) const { Type::getInt8PtrTy(M.getContext())); // MSVC CRT has a function to validate security cookie. - auto *SecurityCheckCookie = cast<Function>( - M.getOrInsertFunction("__security_check_cookie", - Type::getVoidTy(M.getContext()), - Type::getInt8PtrTy(M.getContext()))); - SecurityCheckCookie->setCallingConv(CallingConv::X86_FastCall); - SecurityCheckCookie->addAttribute(1, Attribute::AttrKind::InReg); + FunctionCallee SecurityCheckCookie = M.getOrInsertFunction( + "__security_check_cookie", Type::getVoidTy(M.getContext()), + Type::getInt8PtrTy(M.getContext())); + if (Function *F = dyn_cast<Function>(SecurityCheckCookie.getCallee())) { + F->setCallingConv(CallingConv::X86_FastCall); + F->addAttribute(1, Attribute::AttrKind::InReg); + } return; } // glibc, bionic, and Fuchsia have a special slot for the stack guard. diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp index 65d93b61f93..d302d34e2c3 100644 --- a/llvm/lib/Target/X86/X86WinEHState.cpp +++ b/llvm/lib/Target/X86/X86WinEHState.cpp @@ -86,15 +86,15 @@ private: StructType *EHLinkRegistrationTy = nullptr; StructType *CXXEHRegistrationTy = nullptr; StructType *SEHRegistrationTy = nullptr; - Constant *SetJmp3 = nullptr; - Constant *CxxLongjmpUnwind = nullptr; + FunctionCallee SetJmp3 = nullptr; + FunctionCallee CxxLongjmpUnwind = nullptr; // Per-function state EHPersonality Personality = EHPersonality::Unknown; Function *PersonalityFn = nullptr; bool UseStackGuard = false; int ParentBaseState; - Constant *SehLongjmpUnwind = nullptr; + FunctionCallee SehLongjmpUnwind = nullptr; Constant *Cookie = nullptr; /// The stack allocation containing all EH data, including the link in the @@ -303,7 +303,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) { CxxLongjmpUnwind = TheModule->getOrInsertFunction( "__CxxLongjmpUnwind", FunctionType::get(VoidTy, Int8PtrType, /*isVarArg=*/false)); - cast<Function>(CxxLongjmpUnwind->stripPointerCasts()) + cast<Function>(CxxLongjmpUnwind.getCallee()->stripPointerCasts()) ->setCallingConv(CallingConv::X86_StdCall); } else if (Personality == EHPersonality::MSVC_X86SEH) { // If _except_handler4 is in use, some additional guard checks and prologue @@ -356,7 +356,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) { UseStackGuard ? "_seh_longjmp_unwind4" : "_seh_longjmp_unwind", FunctionType::get(Type::getVoidTy(TheModule->getContext()), Int8PtrType, /*isVarArg=*/false)); - cast<Function>(SehLongjmpUnwind->stripPointerCasts()) + cast<Function>(SehLongjmpUnwind.getCallee()->stripPointerCasts()) ->setCallingConv(CallingConv::X86_StdCall); } else { llvm_unreachable("unexpected personality function"); @@ -471,11 +471,11 @@ void WinEHStatePass::rewriteSetJmpCallSite(IRBuilder<> &Builder, Function &F, SmallVector<Value *, 3> OptionalArgs; if (Personality == EHPersonality::MSVC_CXX) { - OptionalArgs.push_back(CxxLongjmpUnwind); + OptionalArgs.push_back(CxxLongjmpUnwind.getCallee()); OptionalArgs.push_back(State); OptionalArgs.push_back(emitEHLSDA(Builder, &F)); } else if (Personality == EHPersonality::MSVC_X86SEH) { - OptionalArgs.push_back(SehLongjmpUnwind); + OptionalArgs.push_back(SehLongjmpUnwind.getCallee()); OptionalArgs.push_back(State); if (UseStackGuard) OptionalArgs.push_back(Cookie); @@ -766,7 +766,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) { if (!CS) continue; if (CS.getCalledValue()->stripPointerCasts() != - SetJmp3->stripPointerCasts()) + SetJmp3.getCallee()->stripPointerCasts()) continue; SetJmp3CallSites.push_back(CS); |