diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r-- | llvm/lib/Transforms/IPO/CrossDSOCFI.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp | 14 |
2 files changed, 9 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp index e30b33aa487..83fa106df79 100644 --- a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp +++ b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp @@ -105,10 +105,10 @@ void CrossDSOCFI::buildCFICheck(Module &M) { } LLVMContext &Ctx = M.getContext(); - FunctionCallee C = M.getOrInsertFunction( + Constant *C = M.getOrInsertFunction( "__cfi_check", Type::getVoidTy(Ctx), Type::getInt64Ty(Ctx), Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx)); - Function *F = dyn_cast<Function>(C.getCallee()); + Function *F = dyn_cast<Function>(C); // Take over the existing function. The frontend emits a weak stub so that the // linker knows about the symbol; this pass replaces the function body. F->deleteBody(); @@ -132,9 +132,9 @@ void CrossDSOCFI::buildCFICheck(Module &M) { BasicBlock *TrapBB = BasicBlock::Create(Ctx, "fail", F); IRBuilder<> IRBFail(TrapBB); - FunctionCallee CFICheckFailFn = - M.getOrInsertFunction("__cfi_check_fail", Type::getVoidTy(Ctx), - Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx)); + Constant *CFICheckFailFn = M.getOrInsertFunction( + "__cfi_check_fail", Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), + Type::getInt8PtrTy(Ctx)); IRBFail.CreateCall(CFICheckFailFn, {&CFICheckFailData, &Addr}); IRBFail.CreateBr(ExitBB); diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index fc46421d214..c7d815232ef 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -1494,10 +1494,8 @@ void DevirtModule::importResolution(VTableSlot Slot, VTableSlotInfo &SlotInfo) { if (Res.TheKind == WholeProgramDevirtResolution::SingleImpl) { // The type of the function in the declaration is irrelevant because every // call site will cast it to the correct type. - Constant *SingleImpl = - cast<Constant>(M.getOrInsertFunction(Res.SingleImplName, - Type::getVoidTy(M.getContext())) - .getCallee()); + auto *SingleImpl = M.getOrInsertFunction( + Res.SingleImplName, Type::getVoidTy(M.getContext())); // This is the import phase so we should not be exporting anything. bool IsExported = false; @@ -1539,12 +1537,8 @@ void DevirtModule::importResolution(VTableSlot Slot, VTableSlotInfo &SlotInfo) { } if (Res.TheKind == WholeProgramDevirtResolution::BranchFunnel) { - // The type of the function is irrelevant, because it's bitcast at calls - // anyhow. - Constant *JT = cast<Constant>( - M.getOrInsertFunction(getGlobalName(Slot, {}, "branch_funnel"), - Type::getVoidTy(M.getContext())) - .getCallee()); + auto *JT = M.getOrInsertFunction(getGlobalName(Slot, {}, "branch_funnel"), + Type::getVoidTy(M.getContext())); bool IsExported = false; applyICallBranchFunnel(SlotInfo, JT, IsExported); assert(!IsExported); |