aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h')
-rw-r--r--mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
index 64cf09e..9f36e5c 100644
--- a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
+++ b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
@@ -103,7 +103,7 @@ public:
LLVMFuncOp funcOp = appendOrGetFuncOp(funcName, funcType, op);
auto callOp =
- rewriter.create<LLVM::CallOp>(op->getLoc(), funcOp, castedOperands);
+ LLVM::CallOp::create(rewriter, op->getLoc(), funcOp, castedOperands);
if (resultType == adaptor.getOperands().front().getType()) {
rewriter.replaceOp(op, {callOp.getResult()});
@@ -115,19 +115,20 @@ public:
// there is no guarantee of a specific value being used to indicate true,
// compare for inequality with zero (rather than truncate or shift).
if (isResultBool) {
- Value zero = rewriter.create<LLVM::ConstantOp>(
- op->getLoc(), rewriter.getIntegerType(32),
- rewriter.getI32IntegerAttr(0));
- Value truncated = rewriter.create<LLVM::ICmpOp>(
- op->getLoc(), LLVM::ICmpPredicate::ne, callOp.getResult(), zero);
+ Value zero = LLVM::ConstantOp::create(rewriter, op->getLoc(),
+ rewriter.getIntegerType(32),
+ rewriter.getI32IntegerAttr(0));
+ Value truncated =
+ LLVM::ICmpOp::create(rewriter, op->getLoc(), LLVM::ICmpPredicate::ne,
+ callOp.getResult(), zero);
rewriter.replaceOp(op, {truncated});
return success();
}
assert(callOp.getResult().getType().isF32() &&
"only f32 types are supposed to be truncated back");
- Value truncated = rewriter.create<LLVM::FPTruncOp>(
- op->getLoc(), adaptor.getOperands().front().getType(),
+ Value truncated = LLVM::FPTruncOp::create(
+ rewriter, op->getLoc(), adaptor.getOperands().front().getType(),
callOp.getResult());
rewriter.replaceOp(op, {truncated});
return success();
@@ -142,8 +143,9 @@ public:
if (!f16Func.empty() && isa<Float16Type>(type))
return operand;
- return rewriter.create<LLVM::FPExtOp>(
- operand.getLoc(), Float32Type::get(rewriter.getContext()), operand);
+ return LLVM::FPExtOp::create(rewriter, operand.getLoc(),
+ Float32Type::get(rewriter.getContext()),
+ operand);
}
Type getFunctionType(Type resultType, ValueRange operands) const {
@@ -169,7 +171,7 @@ public:
// location as debug info metadata inside of a function cannot be used
// outside of that function.
auto globalloc = op->getLoc()->findInstanceOfOrUnknown<FileLineColLoc>();
- return b.create<LLVMFuncOp>(globalloc, funcName, funcType);
+ return LLVMFuncOp::create(b, globalloc, funcName, funcType);
}
StringRef getFunctionName(Type type, SourceOp op) const {