[llvm] [VPlan] Add VPInstruction::Intrinsic opcode, use for scalar intrinsics. (PR #207541)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 5 12:02:32 PDT 2026


================
@@ -435,10 +435,22 @@ class VPBuilder {
         new VPInstructionWithType(Opcode, Op, ResultTy, Flags, Metadata, DL));
   }
 
-  /// Create a VScale VPInstruction.
+  /// Create a scalar call to the intrinsic \p IntrinsicID with \p Operands, and
+  /// result type \p ResultTy
+  VPInstruction *createScalarIntrinsic(Intrinsic::ID IntrinsicID,
+                                       ArrayRef<VPValue *> Operands,
+                                       Type *ResultTy, DebugLoc DL) {
+    VPlan &Plan = getPlan();
+    SmallVector<VPValue *, 2> Ops(Operands);
+    Ops.push_back(Plan.getConstantInt(32, IntrinsicID));
----------------
artagnon wrote:

Hm, slightly worried about hard-coding 32 here? Can we probably use sizeof(Intrinsic::ID) * 8, or is that not a good idea?

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


More information about the llvm-commits mailing list