summaryrefslogtreecommitdiffstats
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.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index c7d815232ef..fc46421d214 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -1494,8 +1494,10 @@ 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.
- auto *SingleImpl = M.getOrInsertFunction(
- Res.SingleImplName, Type::getVoidTy(M.getContext()));
+ Constant *SingleImpl =
+ cast<Constant>(M.getOrInsertFunction(Res.SingleImplName,
+ Type::getVoidTy(M.getContext()))
+ .getCallee());
// This is the import phase so we should not be exporting anything.
bool IsExported = false;
@@ -1537,8 +1539,12 @@ void DevirtModule::importResolution(VTableSlot Slot, VTableSlotInfo &SlotInfo) {
}
if (Res.TheKind == WholeProgramDevirtResolution::BranchFunnel) {
- auto *JT = M.getOrInsertFunction(getGlobalName(Slot, {}, "branch_funnel"),
- Type::getVoidTy(M.getContext()));
+ // 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());
bool IsExported = false;
applyICallBranchFunnel(SlotInfo, JT, IsExported);
assert(!IsExported);
OpenPOWER on IntegriCloud