diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-06-11 16:35:55 +0100 |
---|---|---|
committer | Jeremy Morse <jeremy.morse@sony.com> | 2025-06-11 17:35:29 +0100 |
commit | 459475020aeff15d0f886ab99c59d66b744d3e17 (patch) | |
tree | d16e4a84e71cc75e3183cb6d0a68a86453722d84 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | fe7bf4b90b1a835418bddd2b2aa63b4977a9f6d2 (diff) | |
download | llvm-459475020aeff15d0f886ab99c59d66b744d3e17.zip llvm-459475020aeff15d0f886ab99c59d66b744d3e17.tar.gz llvm-459475020aeff15d0f886ab99c59d66b744d3e17.tar.bz2 |
Reapply 76197ea6f91f after removing an assertion
Specifically this is the assertion in BasicBlock.cpp. Now that we're not
examining or setting that flag consistently (because it'll be deleted in
about an hour) there's no need to keep this assertion.
Original commit title:
[DebugInfo][RemoveDIs] Remove some debug intrinsic-only codepaths (#143451)
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 0681ebc..ff69fa9 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -606,7 +606,6 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, // Use a map to unique and a vector to guarantee deterministic ordering. llvm::SmallDenseSet<DebugVariable, 4> DeadDebugSet; - llvm::SmallVector<DbgVariableIntrinsic *, 4> DeadDebugInst; llvm::SmallVector<DbgVariableRecord *, 4> DeadDbgVariableRecords; if (ExitBlock) { @@ -633,29 +632,19 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, U.set(Poison); } - // RemoveDIs: do the same as below for DbgVariableRecords. - if (Block->IsNewDbgInfoFormat) { - for (DbgVariableRecord &DVR : llvm::make_early_inc_range( - filterDbgVars(I.getDbgRecordRange()))) { - DebugVariable Key(DVR.getVariable(), DVR.getExpression(), - DVR.getDebugLoc().get()); - if (!DeadDebugSet.insert(Key).second) - continue; - // Unlinks the DVR from it's container, for later insertion. - DVR.removeFromParent(); - DeadDbgVariableRecords.push_back(&DVR); - } - } - - // For one of each variable encountered, preserve a debug intrinsic (set + // For one of each variable encountered, preserve a debug record (set // to Poison) and transfer it to the loop exit. This terminates any // variable locations that were set during the loop. - auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I); - if (!DVI) - continue; - if (!DeadDebugSet.insert(DebugVariable(DVI)).second) - continue; - DeadDebugInst.push_back(DVI); + for (DbgVariableRecord &DVR : + llvm::make_early_inc_range(filterDbgVars(I.getDbgRecordRange()))) { + DebugVariable Key(DVR.getVariable(), DVR.getExpression(), + DVR.getDebugLoc().get()); + if (!DeadDebugSet.insert(Key).second) + continue; + // Unlinks the DVR from it's container, for later insertion. + DVR.removeFromParent(); + DeadDbgVariableRecords.push_back(&DVR); + } } // After the loop has been deleted all the values defined and modified @@ -671,9 +660,6 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, "There should be a non-PHI instruction in exit block, else these " "instructions will have no parent."); - for (auto *DVI : DeadDebugInst) - DVI->moveBefore(*ExitBlock, InsertDbgValueBefore); - // Due to the "head" bit in BasicBlock::iterator, we're going to insert // each DbgVariableRecord right at the start of the block, wheras dbg.values // would be repeatedly inserted before the first instruction. To replicate |