[llvm] [LV] Vectorize conditional scalar assignments (PR #158088)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 02:19:49 PST 2025


================
@@ -915,6 +916,17 @@ Value *VPInstruction::generate(VPTransformState &State) {
   }
   case VPInstruction::ResumeForEpilogue:
     return State.get(getOperand(0), true);
+  case VPInstruction::ExtractLastActive: {
+    Value *Data = State.get(getOperand(0));
+    Value *Mask = State.get(getOperand(1));
+    Value *Default = State.get(getOperand(2), /*IsScalar=*/true);
+    Type *VTy = Data->getType();
+
+    Module *M = State.Builder.GetInsertBlock()->getModule();
+    Function *ExtractLast = Intrinsic::getOrInsertDeclaration(
+        M, Intrinsic::experimental_vector_extract_last_active, {VTy});
+    return Builder.CreateCall(ExtractLast, {Data, Mask, Default});
----------------
fhahn wrote:

Can we use CreateIntrinsic here?

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


More information about the llvm-commits mailing list