diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2019-05-20 11:24:39 +0000 |
---|---|---|
committer | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2019-05-20 11:24:39 +0000 |
commit | 95805bc425b264805a472232a75ed2ffe58aceda (patch) | |
tree | f97f38d1d7ec51c28c24301491428124f6417670 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | 63514556c49552b0694d6d8fe39022a7e1ffb989 (diff) | |
download | bcm5719-llvm-95805bc425b264805a472232a75ed2ffe58aceda.tar.gz bcm5719-llvm-95805bc425b264805a472232a75ed2ffe58aceda.zip |
Revert "[DebugInfo] Update loop metadata for inlined loops"
This reverts commit 6e8f1a80cd988db8870aff9c3bc2ca7a20e04104.
Reverting patch while investigating build bot failure.
llvm-svn: 361143
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 7f1074915a3..b0f351f1ee2 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1351,44 +1351,6 @@ static bool allocaWouldBeStaticInEntry(const AllocaInst *AI ) { return isa<Constant>(AI->getArraySize()) && !AI->isUsedWithInAlloca(); } -/// Returns a DebugLoc for a new DILocation which is a clone of \p OrigDL -/// inlined at \p InlinedAt. \p IANodes is an inlined-at cache. -static DebugLoc inlineDebugLoc(DebugLoc OrigDL, DILocation *InlinedAt, - LLVMContext &Ctx, - DenseMap<const MDNode *, MDNode *> &IANodes) { - auto IA = DebugLoc::appendInlinedAt(OrigDL, InlinedAt, Ctx, IANodes); - return DebugLoc::get(OrigDL.getLine(), OrigDL.getCol(), OrigDL.getScope(), - IA); -} - -/// Returns the LoopID for a loop which has has been cloned from another -/// function for inlining with the new inlined-at start and end locs. -static MDNode *inlineLoopID(const MDNode *OrigLoopId, DILocation *InlinedAt, - LLVMContext &Ctx, - DenseMap<const MDNode *, MDNode *> &IANodes) { - assert(OrigLoopId && OrigLoopId->getNumOperands() > 0 && - "Loop ID needs at least one operand"); - assert(OrigLoopId && OrigLoopId->getOperand(0).get() == OrigLoopId && - "Loop ID should refer to itself"); - - // Save space for the self-referential LoopID. - SmallVector<Metadata *, 4> MDs = {nullptr}; - - for (unsigned i = 1; i < OrigLoopId->getNumOperands(); ++i) { - Metadata *MD = OrigLoopId->getOperand(i); - // Update the DILocations to encode the inlined-at metadata. - if (DILocation *DL = dyn_cast<DILocation>(MD)) - MDs.push_back(inlineDebugLoc(DL, InlinedAt, Ctx, IANodes)); - else - MDs.push_back(MD); - } - - MDNode *NewLoopID = MDNode::getDistinct(Ctx, MDs); - // Insert the self-referential LoopID. - NewLoopID->replaceOperandWith(0, NewLoopID); - return NewLoopID; -} - /// Update inlined instructions' line numbers to /// to encode location where these instructions are inlined. static void fixupLineNumbers(Function *Fn, Function::iterator FI, @@ -1414,17 +1376,10 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI, for (; FI != Fn->end(); ++FI) { for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI) { - // Loop metadata needs to be updated so that the start and end locs - // reference inlined-at locations. - if (MDNode *LoopID = BI->getMetadata(LLVMContext::MD_loop)) { - MDNode *NewLoopID = - inlineLoopID(LoopID, InlinedAtNode, BI->getContext(), IANodes); - BI->setMetadata(LLVMContext::MD_loop, NewLoopID); - } - if (DebugLoc DL = BI->getDebugLoc()) { - DebugLoc IDL = - inlineDebugLoc(DL, InlinedAtNode, BI->getContext(), IANodes); + auto IA = DebugLoc::appendInlinedAt(DL, InlinedAtNode, BI->getContext(), + IANodes); + auto IDL = DebugLoc::get(DL.getLine(), DL.getCol(), DL.getScope(), IA); BI->setDebugLoc(IDL); continue; } |