[Mlir-commits] [mlir] [MLIR][LLVMIR] Import unregistered intrinsics via llvm.intrinsic_call (PR #128626)
Tobias Gysi
llvmlistbot at llvm.org
Tue Feb 25 12:54:57 PST 2025
================
@@ -56,6 +56,49 @@ static ArrayRef<unsigned> getSupportedIntrinsicsImpl() {
return convertibleIntrinsics;
}
+/// Converts the LLVM intrinsic to a generic LLVM intrinsic call using
+/// llvm.intrinsic_call. Returns failure otherwise.
+static LogicalResult
+convertUnregisteredIntrinsicImpl(OpBuilder &odsBuilder, llvm::CallInst *inst,
+ LLVM::ModuleImport &moduleImport) {
+ StringRef intrinName = inst->getCalledFunction()->getName();
+
+ // Sanity check the intrinsic ID.
+ SmallVector<llvm::Value *> args(inst->args());
+ ArrayRef<llvm::Value *> llvmOperands(args);
+
+ SmallVector<llvm::OperandBundleUse> llvmOpBundles;
+ llvmOpBundles.reserve(inst->getNumOperandBundles());
+ for (unsigned i = 0; i < inst->getNumOperandBundles(); ++i)
+ llvmOpBundles.push_back(inst->getOperandBundleAt(i));
+
+ SmallVector<Value> mlirOperands;
+ SmallVector<NamedAttribute> mlirAttrs;
+ if (failed(moduleImport.convertIntrinsicArguments(
+ llvmOperands, llvmOpBundles, false, {}, {}, mlirOperands, mlirAttrs)))
+ return failure();
+
+ mlir::Type results = moduleImport.convertType(inst->getType());
----------------
gysit wrote:
```suggestion
Type results = moduleImport.convertType(inst->getType());
```
nit:
https://github.com/llvm/llvm-project/pull/128626
More information about the Mlir-commits
mailing list