[llvm] [ExpandVectorPredication] Expand vp.load.ff. (PR #154440)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 23:54:59 PDT 2025


================
@@ -465,6 +465,21 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder,
         VPI.getName());
     break;
   }
+  case Intrinsic::vp_load_ff: {
+    // Mask out all but the first lane.
+    Value *NewMask = ConstantInt::getFalse(MaskParam->getType());
+    NewMask = Builder.CreateInsertElement(
+        NewMask, ConstantInt::getTrue(MaskParam->getType()->getScalarType()),
+        (uint64_t)0);
+    NewMask = Builder.CreateAnd(MaskParam, NewMask);
+    Value *MaskedLoad = Builder.CreateMaskedLoad(
+        VPI.getType()->subtypes()[0], PtrParam, AlignOpt.valueOrOne(), NewMask);
+    Value *EVLResult = Builder.getInt32(1);
----------------
lukel97 wrote:

Yeah. Or we could keep the EVL as legal for vp.load.ff in `sanitizeStrategy` when the op strategy is convert. And change the op strategy to convert if the EVL isn't legal. 

That way we have access to the original EVL in `expandPredicationInMemoryIntrinsic`

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


More information about the llvm-commits mailing list