Use CallSite to simplify code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2016-11-29 19:42:27 +00:00
parent a55fccbc47
commit 375d719e55

View File

@ -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 '") +