From 831b65202053cd7e9d1994310ccf075201750a60 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 29 Nov 2016 19:42:27 +0000 Subject: [PATCH] Use CallSite to simplify code llvm-svn: 288192 --- llvm/lib/Transforms/IPO/SampleProfile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index cf0e02e..560bc3e 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(I); - InvokeInst *II = dyn_cast(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 '") + -- 2.7.4