aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2023-12-05 11:59:26 +0000
committerGitHub <noreply@github.com>2023-12-05 11:59:26 +0000
commit600c12987e17d8be174bb4e4cd95244c598676e6 (patch)
treef6b1d9ee048124883d80710e15e8cf1da2002a35 /llvm/lib/Transforms/Utils/Local.cpp
parent7931426e21753ad330e710148bb291e6fdff1dab (diff)
downloadllvm-600c12987e17d8be174bb4e4cd95244c598676e6.zip
llvm-600c12987e17d8be174bb4e4cd95244c598676e6.tar.gz
llvm-600c12987e17d8be174bb4e4cd95244c598676e6.tar.bz2
[DebugInfo][RemoveDIs] Reverse order of DPValues from findDbgUsers (#74099)
The order of dbg.value intrinsics appearing in the output can affect the order of tables in DWARF sections. This means that DPValues, our dbg.value replacement, needs to obey the same ordering rules. For dbg.values returned by findDbgUsers it's reverse order of creation (due to how they're put on use-lists). Produce that order from findDbgUsers for DPValues. I've got a few IR files where the order of dbg.values flips, but it's a fragile test -- ultimately it needs the number of times a DPValue is handled by findDbgValues to be odd.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index e399329..dfc78aa 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2587,14 +2587,7 @@ static bool rewriteDebugUsers(
}
// DPValue implementation of the above.
- // RemoveDIs misery: The above loop of intrinsic-users are ordered by the
- // use-list of the corresponding metadata-as-value: in reverse order of when
- // they were added. Wheras DPUsers are ordered by when they were added to
- // the replaceable-metadata map, i.e., in the order they were added. Thus to
- // have matching orders between the two, we have to reverse here. For
- // RemoveDIs we might in the long run need to consider whether this implicit
- // ordering is relied upon by any other part of LLVM.
- for (auto *DPV : llvm::reverse(DPUsers)) {
+ for (auto *DPV : DPUsers) {
Instruction *MarkedInstr = DPV->getMarker()->MarkedInstr;
Instruction *NextNonDebug = MarkedInstr;
// The next instruction might still be a dbg.declare, skip over it.