summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index 36a1841b3634..59f986b4ca26 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -856,7 +856,7 @@ void llvm::updatePublicTypeTestCalls(Module &M,
return;
if (hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO)) {
Function *TypeTestFunc =
- Intrinsic::getDeclaration(&M, Intrinsic::type_test);
+ Intrinsic::getOrInsertDeclaration(&M, Intrinsic::type_test);
for (Use &U : make_early_inc_range(PublicTypeTestFunc->uses())) {
auto *CI = cast<CallInst>(U.getUser());
auto *NewCI = CallInst::Create(
@@ -1187,7 +1187,8 @@ void DevirtModule::applySingleImplDevirt(VTableSlotInfo &SlotInfo,
Instruction *ThenTerm =
SplitBlockAndInsertIfThen(Cond, &CB, /*Unreachable=*/false);
Builder.SetInsertPoint(ThenTerm);
- Function *TrapFn = Intrinsic::getDeclaration(&M, Intrinsic::debugtrap);
+ Function *TrapFn =
+ Intrinsic::getOrInsertDeclaration(&M, Intrinsic::debugtrap);
auto *CallTrap = Builder.CreateCall(TrapFn);
CallTrap->setDebugLoc(CB.getDebugLoc());
}
@@ -1434,8 +1435,8 @@ void DevirtModule::tryICallBranchFunnel(
}
BasicBlock *BB = BasicBlock::Create(M.getContext(), "", JT, nullptr);
- Function *Intr =
- Intrinsic::getDeclaration(&M, llvm::Intrinsic::icall_branch_funnel, {});
+ Function *Intr = Intrinsic::getOrInsertDeclaration(
+ &M, llvm::Intrinsic::icall_branch_funnel, {});
auto *CI = CallInst::Create(Intr, JTArgs, "", BB);
CI->setTailCallKind(CallInst::TCK_MustTail);
@@ -2026,7 +2027,8 @@ void DevirtModule::scanTypeTestUsers(
}
void DevirtModule::scanTypeCheckedLoadUsers(Function *TypeCheckedLoadFunc) {
- Function *TypeTestFunc = Intrinsic::getDeclaration(&M, Intrinsic::type_test);
+ Function *TypeTestFunc =
+ Intrinsic::getOrInsertDeclaration(&M, Intrinsic::type_test);
for (Use &U : llvm::make_early_inc_range(TypeCheckedLoadFunc->uses())) {
auto *CI = dyn_cast<CallInst>(U.getUser());