[llvm-branch-commits] [llvm] [SSAUpdaterBulk] Add PHI simplification pass. (PR #135180)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 5 11:25:42 PDT 2025


================
@@ -222,3 +223,38 @@ void SSAUpdaterBulk::RewriteAllUses(DominatorTree *DT,
     }
   }
 }
+
+// Perform a single pass of simplification over the worklist of PHIs.
+static void simplifyPass(MutableArrayRef<PHINode *> Worklist,
+                         const DataLayout &DL) {
+  for (PHINode *&PHI : Worklist) {
+    if (Value *Simplified = simplifyInstruction(PHI, DL)) {
+      PHI->replaceAllUsesWith(Simplified);
----------------
arsenm wrote:

Can't RewriteAllUses do this as it sees the phis in the first place? 

https://github.com/llvm/llvm-project/pull/135180


More information about the llvm-branch-commits mailing list