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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 13:59:30 PDT 2026


================
@@ -223,6 +223,20 @@ SmallVector<VPUser *> collectUsersRecursively(VPValue *V);
 VPIRValue *tryToFoldLiveIns(VPSingleDefRecipe &R, ArrayRef<VPValue *> Operands,
                             const DataLayout &DL);
 
+/// Insert phis to reconstruct SSA for a single value starting from \p VPBB. \p
+/// Defs is a map of definitions at specific blocks. Returns the
+/// reconstructed value at VPBB. Use if the CFG has been modified such that a
+/// def no longer dominates all its uses. Every block leading to VPBB must be
+/// reachable from the entry and the plan must be plain-CFG (not contain any
+/// regions).
+LLVM_ABI_FOR_TEST VPValue *
+reconstructSSA(VPBasicBlock *VPBB, DenseMap<VPBasicBlock *, VPValue *> &Defs);
+
+inline VPValue *reconstructSSA(VPBasicBlock *VPBB,
+                               DenseMap<VPBasicBlock *, VPValue *> &&Defs) {
+  return reconstructSSA(VPBB, Defs);
+}
----------------
fhahn wrote:

Why do we need this one? If it is just needed for the tests, would be good to either move to the test file

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


More information about the llvm-commits mailing list