diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -613,7 +613,10 @@ // calls to become direct calls. // CallSites may be modified inside so ranged for loop can not be used. for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) { - CallBase &CS = *CallSites[CSi].first; + int InlineHistoryID; + CallBase *Instr; + std::tie(Instr, InlineHistoryID) = CallSites[CSi]; + CallBase &CS = *Instr; Function *Caller = CS.getCaller(); Function *Callee = CS.getCalledFunction(); @@ -622,19 +625,15 @@ if (!Callee || Callee->isDeclaration()) continue; - Instruction *Instr = &CS; - bool IsTriviallyDead = isInstructionTriviallyDead(Instr, &GetTLI(*Caller)); - int InlineHistoryID; if (!IsTriviallyDead) { // If this call site was obtained by inlining another function, verify // that the include path for the function did not include the callee // itself. If so, we'd be recursively inlining the same function, // which would provide the same callsites, which would cause us to // infinitely inline. - InlineHistoryID = CallSites[CSi].second; if (InlineHistoryID != -1 && inlineHistoryIncludes(Callee, InlineHistoryID, InlineHistory)) { setInlineRemark(CS, "recursive");