From f4a67baf55989c10c0b10056e7851641e9b74e06 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 23 Sep 2026 15:37:37 -0700 Subject: [PATCH] go --- src/passes/RedundantSetElimination.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/passes/RedundantSetElimination.cpp b/src/passes/RedundantSetElimination.cpp index c5017848b1d..17dee6730f3 100644 --- a/src/passes/RedundantSetElimination.cpp +++ b/src/passes/RedundantSetElimination.cpp @@ -34,13 +34,13 @@ // #include +#include #include #include #include #include #include #include -#include #include #include @@ -58,6 +58,10 @@ namespace { // information in a basic block struct Info { + // For RPOQueue + bool inQueue; + Index index; + LocalValues start, end; // the local values at the start and end of the block std::vector items; }; @@ -221,11 +225,9 @@ struct RedundantSetElimination end[i] = unseenValue; } } - // keep working while stuff is flowing. we use a unique deferred queue - // which ensures both FIFO and that we don't do needless work - if - // A and B reach C, and both queue C, we only want to do C at the latest - // time, when we have information from all those reaching it. - UniqueDeferredQueue work; + // Keep working while stuff is flowing, in reverse-postorder so that we + // reach code after its predecessors, avoiding wasted recomputation. + RPOQueue work(*this); work.push(entry); while (!work.empty()) { auto* curr = work.pop();