[llvm] [VPlan] Add vputils::reconstructSSA (PR #212209)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 12:30:54 PDT 2026


================
@@ -1161,3 +1161,44 @@ void vputils::detail::pullOutPermutationsImpl(
     }
   }
 }
+
+/// Implements the algorithm described in "Simple and Efficient Construction of
+/// Static Single Assignment Form" by Braun et al.
+static VPValue *reconstructSSAImpl(VPBasicBlock *VPBB,
+                                   DenseMap<VPBasicBlock *, VPValue *> &Defs) {
+  if (VPValue *Def = Defs.lookup(VPBB))
+    return Def;
+  // If the entry block is reached and there's still no def, then Defs is
+  // missing a definition that covers this path.
+  assert(VPBB->getNumPredecessors() && "Not all paths have def");
----------------
fhahn wrote:

IIUC currently only plain-cfg cases (i.e. no regions) are supported, right? Would be good to clarify in the doc-comment and assert somewhere. Otherwise we would probably need to use `getCFGPredecessor` & co 

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


More information about the llvm-commits mailing list