diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2025-06-24 13:09:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-24 13:09:49 +0100 |
commit | 352baa386c10ef62ef190023e5b6a3434e84dc1f (patch) | |
tree | 5d75949aca7ab00977a3b56d5144c030b33cd55b /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 825ad86aea5016f0466347862c8f6d23894ddc5a (diff) | |
download | llvm-352baa386c10ef62ef190023e5b6a3434e84dc1f.zip llvm-352baa386c10ef62ef190023e5b6a3434e84dc1f.tar.gz llvm-352baa386c10ef62ef190023e5b6a3434e84dc1f.tar.bz2 |
[RemoveDIs] Resolve RemoveRedundantDbgInstrs fwd scan FIXME (#144718)
These FIXMEs were added to keep the dbg_record implementation identical to the
dbg intrinsic versions, which have since been removed. I don't think there's any
reason for the old behaviour; my understanding is it was a minor bug no one got
round to fixing.
I've upgraded the test to be written with dbg_records while I'm here.
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 98c65ae..c825574 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -377,33 +377,14 @@ bool llvm::MergeBlockSuccessorsIntoGivenBlocks( /// /// Possible improvements: /// - Check fully overlapping fragments and not only identical fragments. -/// - Support dbg.declare. dbg.label, and possibly other meta instructions being -/// part of the sequence of consecutive instructions. static bool DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) { SmallVector<DbgVariableRecord *, 8> ToBeRemoved; SmallDenseSet<DebugVariable> VariableSet; for (auto &I : reverse(*BB)) { - for (DbgRecord &DR : reverse(I.getDbgRecordRange())) { - if (isa<DbgLabelRecord>(DR)) { - // Emulate existing behaviour (see comment below for dbg.declares). - // FIXME: Don't do this. - VariableSet.clear(); - continue; - } - + for (DbgVariableRecord &DR : + reverse(filterDbgVars(I.getDbgRecordRange()))) { DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR); - // Skip declare-type records, as the debug intrinsic method only works - // on dbg.value intrinsics. - if (DVR.getType() == DbgVariableRecord::LocationType::Declare) { - // The debug intrinsic method treats dbg.declares are "non-debug" - // instructions (i.e., a break in a consecutive range of debug - // intrinsics). Emulate that to create identical outputs. See - // "Possible improvements" above. - // FIXME: Delete the line below. - VariableSet.clear(); - continue; - } DebugVariable Key(DVR.getVariable(), DVR.getExpression(), DVR.getDebugLoc()->getInlinedAt()); |