From 375d719e559c9aef3576894438fa0f3dfc9921e5 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288192 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/SampleProfile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/IPO/SampleProfile.cpp b/lib/Transforms/IPO/SampleProfile.cpp index cf0e02e8ecc..560bc3ef491 100644 --- a/lib/Transforms/IPO/SampleProfile.cpp +++ b/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.50.1