[Mlir-commits] [mlir] [mlir][llvmir] Added extra builders for CallInstrinsicOp (PR #111664)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 9 04:53:25 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Finlay (FMarno)
<details>
<summary>Changes</summary>
I've added the extra builders I would like to see for CallIntrinsicOp.
This is inspired by the comment from @<!-- -->antiagainst from [here](https://github.com/llvm/llvm-project/pull/108933#issuecomment-2392751569). I am also building Triton.
---
Full diff: https://github.com/llvm/llvm-project/pull/111664.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td (+5)
- (modified) mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp (+19)
``````````diff
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 88e82ce48959b0..ff5199fe40d124 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -1943,6 +1943,11 @@ def LLVM_CallIntrinsicOp
attr-dict
}];
+ let builders = [
+ OpBuilder<(ins "Type": $results, "StringAttr":$intrin, "ValueRange":$args)>,
+ OpBuilder<(ins "TypeRange": $results, "StringAttr":$intrin, "ValueRange":$args, "FastmathFlagsAttr":$fastMathFlags)>
+ ];
+
let hasVerifier = 1;
}
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index fb7024a14f8d4e..27cbd77f110326 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -3353,6 +3353,25 @@ struct LLVMOpAsmDialectInterface : public OpAsmDialectInterface {
};
} // namespace
+//===----------------------------------------------------------------------===//
+// CallIntrinsicOp
+//===----------------------------------------------------------------------===//
+
+void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
+ mlir::TypeRange results, mlir::StringAttr intrin,
+ mlir::ValueRange args,
+ mlir::LLVM::FastmathFlagsAttr fastMathFlags) {
+
+ build(builder, state, results, intrin, args, fastMathFlags,
+ llvm::ArrayRef<mlir::ValueRange>{});
+}
+void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
+ mlir::Type results, mlir::StringAttr intrin,
+ mlir::ValueRange args) {
+ build(builder, state, {results}, intrin, args, FastmathFlagsAttr{},
+ llvm::ArrayRef<mlir::ValueRange>{});
+}
+
//===----------------------------------------------------------------------===//
// LinkerOptionsOp
//===----------------------------------------------------------------------===//
``````````
</details>
https://github.com/llvm/llvm-project/pull/111664
More information about the Mlir-commits
mailing list