summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index cf0e02e8ecc..560bc3ef491 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -647,15 +647,13 @@ bool SampleProfileLoader::inlineHotFunctions(Function &F) {
}
for (auto I : CIS) {
InlineFunctionInfo IFI(nullptr, ACT ? &GetAssumptionCache : nullptr);
- CallInst *CI = dyn_cast<CallInst>(I);
- InvokeInst *II = dyn_cast<InvokeInst>(I);
- Function *CalledFunction =
- (CI == nullptr ? II->getCalledFunction() : CI->getCalledFunction());
+ CallSite CS(I);
+ Function *CalledFunction = CS.getCalledFunction();
if (!CalledFunction || !CalledFunction->getSubprogram())
continue;
DebugLoc DLoc = I->getDebugLoc();
uint64_t NumSamples = findCalleeFunctionSamples(*I)->getTotalSamples();
- if ((CI && InlineFunction(CI, IFI)) || (II && InlineFunction(II, IFI))) {
+ if (InlineFunction(CS, IFI)) {
LocalChanged = true;
emitOptimizationRemark(Ctx, DEBUG_TYPE, F, DLoc,
Twine("inlined hot callee '") +
OpenPOWER on IntegriCloud