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

Valery Pykhtin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 6 05:47:37 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);
----------------
vpykhtin wrote:

I thought about doing this but it complicates things: this would require to use tracking VH in the BBInfo structure, I'm not sure it worth it. 

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


More information about the llvm-branch-commits mailing list