VPIntrinsic::getStaticVectorLength infers the operational vector length
of a VPIntrinsic instance from a type that is used with the intrinsic.
The function used the mask operand before. Yet, vp.merge|select do not
have a mask operand (in the predicating sense that the other VP
intrinsics are using them - it is a selection mask for them). Fallback
to the return type to fix this.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D121913
///// Shuffles {
+// The mask 'cond' operand of llvm.vp.select and llvm.vp.merge are not reported
+// as masks with the BEGIN_REGISTER_VP_* macros. This is because, unlike other
+// VP intrinsics, these two have a defined result on lanes where the mask is
+// false.
+//
// llvm.vp.select(cond,on_true,on_false,vlen)
BEGIN_REGISTER_VP(vp_select, None, 3, VP_SELECT, -1)
VP_PROPERTY_FUNCTIONAL_OPC(Select)
};
Value *VPMask = getMaskParam();
- assert(VPMask && "No mask param?");
+ if (!VPMask) {
+ assert((getIntrinsicID() == Intrinsic::vp_merge ||
+ getIntrinsicID() == Intrinsic::vp_select) &&
+ "Unexpected VP intrinsic without mask operand");
+ return GetVectorLengthOfType(getType());
+ }
return GetVectorLengthOfType(VPMask->getType());
}