diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-06-11 14:43:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-11 14:43:15 +0100 |
commit | c71a2e688828ab3ede4fb54168a674ff68396f61 (patch) | |
tree | b62f008e717b4233949489263ac349723d39dfdc /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | 6b0cb762af97579ca8ff5eea9be896169a1752b7 (diff) | |
download | llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.zip llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.tar.gz llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.tar.bz2 |
[DebugInfo][RemoveDIs] Remove some debug intrinsic-only codepaths (#143451)
These are opportunistic deletions as more places that make use of the
IsNewDbgInfoFormat flag are removed. It should (TM)(R) all be dead code
now that `IsNewDbgInfoFormat` should be true everywhere.
FastISel: we don't need to do debug-aware instruction counting any more,
because there are no debug instructions,
Autoupgrade: you can no-longer avoid autoupgrading of intrinsics to
records
DIBuilder: Delete the code for creating debug intrinsics (!)
LoopUtils: No need to handle debug instructions, they don't exist
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 |