[llvm] [VPlan] Use VPlan operand order for VPBlendRecipes. (PR #139475)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 05:54:58 PDT 2025


================
@@ -8954,15 +8948,18 @@ bool VPRecipeBuilder::getScaledReductions(
   return false;
 }
 
-VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
-    Instruction *Instr, ArrayRef<VPValue *> Operands, VFRange &Range) {
+VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
+                                                      VFRange &Range) {
   // First, check for specific widening recipes that deal with inductions, Phi
   // nodes, calls and memory operations.
   VPRecipeBase *Recipe;
-  if (auto *Phi = dyn_cast<PHINode>(Instr)) {
-    if (Phi->getParent() != OrigLoop->getHeader())
-      return tryToBlend(Phi, Operands);
+  Instruction *Instr = R->getUnderlyingInstr();
+  SmallVector<VPValue *, 4> Operands(R->operands());
+  if (auto *PhiR = dyn_cast<VPWidenPHIRecipe>(R)) {
+    if (PhiR->getParent()->getNumPredecessors() != 0)
----------------
ayalz wrote:

This works in HCFG mode, excluding VPlan's entry block - which should be free of VPWidenPHIRecipes. Clearer to ask explicitly if PhiR's parental block differs from the entry of it enclosing parental region?

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


More information about the llvm-commits mailing list