[Mlir-commits] [mlir] [mlir][LLVM] Support `immargs` in LLVM_IntrOpBase intrinsics (PR #73013)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Nov 22 04:55:49 PST 2023


================
@@ -1276,7 +1276,7 @@ struct VectorScalableInsertOpLowering
   matchAndRewrite(vector::ScalableInsertOp insOp, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
     rewriter.replaceOpWithNewOp<LLVM::vector_insert>(
-        insOp, adaptor.getSource(), adaptor.getDest(), adaptor.getPos());
+        insOp, adaptor.getDest(), adaptor.getSource(), adaptor.getPos());
----------------
MacDue wrote:

There's no bug in the pattern here, I just had to change the order of the operands in the `LLVM::vector_insert` intrinsic to match the equivalent LLVM IR intrinsic. Since if I didn't do that the generated import/export code would fail. 
I then had to make sure all users of the intrinsic also changed the order of operands in the builder calls. This is the only user (as only `vector.scalable.insert` lowers to this intrinsic). 

Note: `LLVM::vector_insert` is the intrinsic (https://llvm.org/docs/LangRef.html#llvm-vector-insert-intrinsic), not to be confused with the insertelement instruction (https://llvm.org/docs/LangRef.html#insertelement-instruction).

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


More information about the Mlir-commits mailing list