[llvm] [LLVM][VPlan] Keep all VPBlend masks until VPlan transformation. (PR #104015)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 24 21:47:59 PDT 2024
================
@@ -2048,19 +2048,25 @@ class VPBlendRecipe : public VPSingleDefRecipe {
VP_CLASSOF_IMPL(VPDef::VPBlendSC)
- /// Return the number of incoming values, taking into account that the first
- /// incoming value has no mask.
- unsigned getNumIncomingValues() const { return (getNumOperands() + 1) / 2; }
+ /// A normalized blend is one that has an odd number of operands, whereby the
+ /// first operand does not have an associated mask.
+ bool isNormalized() const { return getNumOperands() % 2; }
----------------
ayalz wrote:
> I've investigated a little and to me this change makes VBlend harder to work with. Nothing major, just minor things like not being able to write `for i = 1 < num_of_coming values`.
Changing the order in which operand pairs are held should keep the API of accessing and traversing them in tact, only simplifying how these are implemented. Perhaps main distinction is traversing from last to first instead of from first to last.
> What do you think about VBlend taking an explicit initial value which the masked operands are blended in to? For most cases this would be `undef` or perhaps `poison` assuming we're happy to always lose the poison during normalisation.
Sounds like another "optional" operand. Suffice to simplify how the redundant mask operand is handled?
https://github.com/llvm/llvm-project/pull/104015
More information about the llvm-commits
mailing list