diff options
author | Harald van Dijk <harald.vandijk@codeplay.com> | 2025-02-12 17:50:39 +0000 |
---|---|---|
committer | Harald van Dijk <harald.vandijk@codeplay.com> | 2025-02-12 17:50:39 +0000 |
commit | 23209eb1d9df57ca3419f5abc6b2edcdc0d1dead (patch) | |
tree | 1ded1a640376a5bd69c069755de5365534129a82 /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | 3ec9f7494b31f2fe51d5ed0e07adcf4b7199def6 (diff) | |
download | llvm-23209eb1d9df57ca3419f5abc6b2edcdc0d1dead.zip llvm-23209eb1d9df57ca3419f5abc6b2edcdc0d1dead.tar.gz llvm-23209eb1d9df57ca3419f5abc6b2edcdc0d1dead.tar.bz2 |
Revert "[DebugInfo] Update DIBuilder insertion to take InsertPosition (#126059)"
This reverts commit 3ec9f7494b31f2fe51d5ed0e07adcf4b7199def6.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index e47a6ce..e5e2aa6 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -127,7 +127,7 @@ bool llvm::applyDebugifyMetadata( // Helper that inserts a dbg.value before \p InsertBefore, copying the // location (and possibly the type, if it's non-void) from \p TemplateInst. auto insertDbgVal = [&](Instruction &TemplateInst, - BasicBlock::iterator InsertPt) { + Instruction *InsertBefore) { std::string Name = utostr(NextVar++); Value *V = &TemplateInst; if (TemplateInst.getType()->isVoidTy()) @@ -137,7 +137,7 @@ bool llvm::applyDebugifyMetadata( getCachedDIType(V->getType()), /*AlwaysPreserve=*/true); DIB.insertDbgValueIntrinsic(V, LocalVar, DIB.createExpression(), Loc, - InsertPt); + InsertBefore); }; for (BasicBlock &BB : F) { @@ -161,9 +161,7 @@ bool llvm::applyDebugifyMetadata( // are made. BasicBlock::iterator InsertPt = BB.getFirstInsertionPt(); assert(InsertPt != BB.end() && "Expected to find an insertion point"); - - // Insert after existing debug values to preserve order. - InsertPt.setHeadBit(false); + Instruction *InsertBefore = &*InsertPt; // Attach debug values. for (Instruction *I = &*BB.begin(); I != LastInst; I = I->getNextNode()) { @@ -174,9 +172,9 @@ bool llvm::applyDebugifyMetadata( // Phis and EH pads must be grouped at the beginning of the block. // Only advance the insertion point when we finish visiting these. if (!isa<PHINode>(I) && !I->isEHPad()) - InsertPt = std::next(I->getIterator()); + InsertBefore = I->getNextNode(); - insertDbgVal(*I, InsertPt); + insertDbgVal(*I, InsertBefore); InsertedDbgVal = true; } } @@ -187,7 +185,7 @@ bool llvm::applyDebugifyMetadata( // those tests, and this helps with that.) if (DebugifyLevel == Level::LocationsAndVariables && !InsertedDbgVal) { auto *Term = findTerminatingInstruction(F.getEntryBlock()); - insertDbgVal(*Term, Term->getIterator()); + insertDbgVal(*Term, Term); } if (ApplyToMF) ApplyToMF(DIB, F); |