diff options
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 3dfa2d8..26ff84f 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -583,12 +583,17 @@ static void findFuncPointers(const Constant *I, uint64_t StartingOffset, VTableFuncList &VTableFuncs) { // First check if this is a function pointer. if (I->getType()->isPointerTy()) { - auto Fn = dyn_cast<Function>(I->stripPointerCasts()); - // We can disregard __cxa_pure_virtual as a possible call target, as - // calls to pure virtuals are UB. - if (Fn && Fn->getName() != "__cxa_pure_virtual") - VTableFuncs.push_back({Index.getOrInsertValueInfo(Fn), StartingOffset}); - return; + auto C = I->stripPointerCasts(); + auto A = dyn_cast<GlobalAlias>(C); + if (isa<Function>(C) || (A && isa<Function>(A->getAliasee()))) { + auto GV = dyn_cast<GlobalValue>(C); + assert(GV); + // We can disregard __cxa_pure_virtual as a possible call target, as + // calls to pure virtuals are UB. + if (GV && GV->getName() != "__cxa_pure_virtual") + VTableFuncs.push_back({Index.getOrInsertValueInfo(GV), StartingOffset}); + return; + } } // Walk through the elements in the constant struct or array and recursively |