[llvm] [ExpandVectorPredication] Expand vp_merge and vp_select in expandPredication. (PR #157777)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 21:47:32 PDT 2025


================
@@ -581,6 +581,14 @@ bool CachingVPExpander::expandPredication(VPIntrinsic &VPI) {
     replaceOperation(*NewNegOp, VPI);
     return NewNegOp;
   }
+  case Intrinsic::vp_select:
+  case Intrinsic::vp_merge: {
+    assert(maySpeculateLanes(VPI) || VPI.canIgnoreVectorLengthParam());
----------------
topperc wrote:

I think the code here https://github.com/llvm/llvm-project/blob/27719745e3b0f7bed738a67498e751ca6d45bcdd/llvm/lib/CodeGen/ExpandVectorPredication.cpp#L642 forces the EVLStrategy to Convert if the intrinsic is to be converted.  That causes this code https://github.com/llvm/llvm-project/blob/27719745e3b0f7bed738a67498e751ca6d45bcdd/llvm/lib/CodeGen/ExpandVectorPredication.cpp#L679 to fold the EVL into the mask.

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


More information about the llvm-commits mailing list