[llvm] [MSSAUpdater] Replace recursion with worklist and cap it. (PR #150543)
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 13:57:58 PDT 2025
================
@@ -230,9 +223,61 @@ MemoryAccess *MemorySSAUpdater::tryRemoveTrivialPhi(MemoryPhi *Phi,
removeMemoryAccess(Phi);
}
- // We should only end up recursing in case we replaced something, in which
- // case, we may have made other Phis trivial.
- return recursePhi(Same);
+ // Continue traversal in a DFS worklist approach, in case we might find
+ // other trivial Phis.
+ if (!Same)
+ return nullptr;
+
+ TrackingVH<MemoryAccess> Result(Same);
----------------
alinas wrote:
I pushed a change that I think resolves this. PTAL?
https://github.com/llvm/llvm-project/pull/150543
More information about the llvm-commits
mailing list