[llvm] 863e17a - [VPlan] Make Phi operand for VPReductionPHIRecipe optional (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 14:49:58 PDT 2025


Author: Florian Hahn
Date: 2025-07-01T22:49:27+01:00
New Revision: 863e17a5be77a47eedcd62172b41763783ff183c

URL: https://github.com/llvm/llvm-project/commit/863e17a5be77a47eedcd62172b41763783ff183c
DIFF: https://github.com/llvm/llvm-project/commit/863e17a5be77a47eedcd62172b41763783ff183c.diff

LOG: [VPlan] Make Phi operand for VPReductionPHIRecipe optional (NFC).

VPReductionPHIRecipe doesn't rely on the underlying phi any longer,
allow empty underlying values when cloning. NFC at the moment but will
enable follow-up patches.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 01718ca0ba518..cc9434e9b3b8b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2212,9 +2212,9 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
   ~VPReductionPHIRecipe() override = default;
 
   VPReductionPHIRecipe *clone() override {
-    auto *R = new VPReductionPHIRecipe(cast<PHINode>(getUnderlyingInstr()),
-                                       RdxDesc, *getOperand(0), IsInLoop,
-                                       IsOrdered, VFScaleFactor);
+    auto *R = new VPReductionPHIRecipe(
+        dyn_cast_or_null<PHINode>(getUnderlyingValue()), RdxDesc,
+        *getOperand(0), IsInLoop, IsOrdered, VFScaleFactor);
     R->addOperand(getBackedgeValue());
     return R;
   }


        


More information about the llvm-commits mailing list