[llvm] [VPlan] Remove unused first mask op from VPBlendRecipe. (PR #87770)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 16:41:22 PDT 2024
================
@@ -8245,6 +8245,8 @@ VPBlendRecipe *VPRecipeBuilder::tryToBlend(PHINode *Phi,
"Distinct incoming values with one having a full mask");
break;
}
+ if (In == 0)
+ continue;
----------------
ayalz wrote:
nit: may be better to early-continue earlier - before creating the edge mask, which for first operand is needed only to assert, and for other operands can simplify the assert. Can also simplify simplifyRecipe() to look for single-operand Blends, by doing, e.g.,
```
OperandsWithMask.push_back(Operands[0]);
if (all_equal(Operands)) /* This case is optimized away later (can be simplified). */
return new VPBlendRecipe(Phi, OperandsWithMask);
/* First operand must have a non-full mask, which is ignored. */
assert(createEdgeMask(Phi->getIncomingBlock(0), Phi->getParent()) &&
"Distinct incoming values with one having a full mask");
for (unsigned In = 1; In < NumIncoming; In++) {
OperandsWithMask.push_back(Operands[In]);
VPValue *EdgeMask =
createEdgeMask(Phi->getIncomingBlock(In), Phi->getParent());
assert(EdgeMask && "Both null and non-null edge masks found");
OperandsWithMask.push_back(EdgeMask);
}
return new VPBlendRecipe(Phi, OperandsWithMask);
```
https://github.com/llvm/llvm-project/pull/87770
More information about the llvm-commits
mailing list