-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[mlir][NFC] update LLVM create APIs (2/n) #149667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir][NFC] update LLVM create APIs (2/n) #149667
Conversation
2257ef2
to
b857994
Compare
@llvm/pr-subscribers-mlir-llvm Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 43.98 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149667.diff 11 Files Affected:
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index cd8b68e5b1410..34f5125bf2d09 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -324,7 +324,7 @@ def LLVM_NoAliasScopeDeclOp
return success();
if (scopeAttrs->size() != 1)
return failure();
- $_op = $_builder.create<LLVM::NoAliasScopeDeclOp>(
+ $_op = LLVM::NoAliasScopeDeclOp::create($_builder,
$_location, (*scopeAttrs)[0]);
}];
let assemblyFormat = "$scope attr-dict";
@@ -468,7 +468,7 @@ class LLVM_ConstrainedIntr<string mnem, int numArgs,
$_builder.getNamedAttr($_qualCppClassName::getRoundingModeAttrName(),
roundingModeAttr));
}], true : "") # [{
- $res = $_builder.create<$_qualCppClassName>($_location,
+ $res = $_qualCppClassName::create($_builder, $_location,
$_resultType, mlirOperands, mlirAttrs);
}];
}
@@ -743,7 +743,7 @@ def LLVM_DbgLabelOp : LLVM_IntrOp<"dbg.label", [], [], [], 0> {
// Drop the intrinsic if the label translation fails due to cylic metadata.
if (!labelAttr)
return success();
- $_op = $_builder.create<$_qualCppClassName>($_location, labelAttr);
+ $_op = $_qualCppClassName::create($_builder, $_location, labelAttr);
}];
let assemblyFormat = "$label attr-dict";
}
@@ -883,7 +883,7 @@ def LLVM_MatrixColumnMajorLoadOp : LLVM_OneResultIntrOp<"matrix.column.major.loa
$columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixColumnMajorLoadOp>(
+ $res = LLVM::MatrixColumnMajorLoadOp::create($_builder,
$_location, $_resultType, $data, $stride,
$_int_attr($isVolatile), $_int_attr($rows), $_int_attr($columns));
}];
@@ -917,7 +917,7 @@ def LLVM_MatrixColumnMajorStoreOp : LLVM_ZeroResultIntrOp<"matrix.column.major.s
$rows, $columns);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::MatrixColumnMajorStoreOp>(
+ $_op = LLVM::MatrixColumnMajorStoreOp::create($_builder,
$_location, $matrix, $data, $stride,
$_int_attr($isVolatile), $_int_attr($rows), $_int_attr($columns));
}];
@@ -940,7 +940,7 @@ def LLVM_MatrixMultiplyOp : LLVM_OneResultIntrOp<"matrix.multiply"> {
$rhs_columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixMultiplyOp>(
+ $res = LLVM::MatrixMultiplyOp::create($_builder,
$_location, $_resultType, $lhs, $rhs,
$_int_attr($lhs_rows), $_int_attr($lhs_columns), $_int_attr($rhs_columns));
}];
@@ -960,7 +960,7 @@ def LLVM_MatrixTransposeOp : LLVM_OneResultIntrOp<"matrix.transpose"> {
$matrix, $rows, $columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixTransposeOp>(
+ $res = LLVM::MatrixTransposeOp::create($_builder,
$_location, $_resultType, $matrix,
$_int_attr($rows), $_int_attr($columns));
}];
@@ -997,7 +997,7 @@ def LLVM_MaskedLoadOp : LLVM_OneResultIntrOp<"masked.load"> {
string mlirBuilder = [{
auto *intrinInst = dyn_cast<llvm::IntrinsicInst>(inst);
bool nontemporal = intrinInst->hasMetadata(llvm::LLVMContext::MD_nontemporal);
- $res = $_builder.create<LLVM::MaskedLoadOp>($_location,
+ $res = LLVM::MaskedLoadOp::create($_builder, $_location,
$_resultType, $data, $mask, $pass_thru, $_int_attr($alignment),
nontemporal ? $_builder.getUnitAttr() : nullptr);
}];
@@ -1017,7 +1017,7 @@ def LLVM_MaskedStoreOp : LLVM_ZeroResultIntrOp<"masked.store"> {
$value, $data, llvm::Align($alignment), $mask);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::MaskedStoreOp>($_location,
+ $_op = LLVM::MaskedStoreOp::create($_builder, $_location,
$value, $data, $mask, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 1, 3, 2];
@@ -1040,7 +1040,7 @@ def LLVM_masked_gather : LLVM_OneResultIntrOp<"masked.gather"> {
$_resultType, $ptrs, llvm::Align($alignment), $mask, $pass_thru[0]);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::masked_gather>($_location,
+ $res = LLVM::masked_gather::create($_builder, $_location,
$_resultType, $ptrs, $mask, $pass_thru, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 2, 3, 1];
@@ -1061,7 +1061,7 @@ def LLVM_masked_scatter : LLVM_ZeroResultIntrOp<"masked.scatter"> {
$value, $ptrs, llvm::Align($alignment), $mask);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::masked_scatter>($_location,
+ $_op = LLVM::masked_scatter::create($_builder, $_location,
$value, $ptrs, $mask, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 1, 3, 2];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
index e08c7b7969330..e845ea9f1e604 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
@@ -363,7 +363,7 @@ class LLVM_IntrOpBase<Dialect dialect, string opName, string enumName,
}
SmallVector<Type> resultTypes =
}] # !if(!gt(numResults, 0), "{$_resultType};", "{};") # [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, resultTypes, mlirOperands, mlirAttrs);
}];
string baseMlirBuilderCoda = !if(!gt(numResults, 0), "$res = op;", "$_op = op;");
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 4a9bc90e43d96..51004f592eca4 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -53,7 +53,7 @@ class LLVM_IntArithmeticOp<string mnemonic, string instName,
LLVM_ArithmeticOpBase<AnySignlessInteger, mnemonic, instName, traits> {
let arguments = commonArgs;
string mlirBuilder = [{
- $res = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ $res = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
}];
}
class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
@@ -64,7 +64,7 @@ class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, iofArg);
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setIntegerOverflowFlags(inst, op);
$res = op;
}];
@@ -82,7 +82,7 @@ class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, (ins UnitAttr:$isExact));
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setExactFlag(inst, op);
$res = op;
}];
@@ -100,7 +100,7 @@ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, (ins UnitAttr:$isDisjoint));
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setDisjointFlag(inst, op);
$res = op;
}];
@@ -121,7 +121,7 @@ class LLVM_FloatArithmeticOp<string mnemonic, string instName,
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
}];
@@ -141,7 +141,7 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
let assemblyFormat = "$operand attr-dict `:` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $operand);
+ auto op = $_qualCppClassName::create($_builder, $_location, $operand);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
}];
@@ -193,7 +193,7 @@ def LLVM_ICmpOp : LLVM_ArithmeticCmpOp<"icmp", [Pure]> {
}];
string mlirBuilder = [{
auto *iCmpInst = cast<llvm::ICmpInst>(inst);
- $res = $_builder.create<$_qualCppClassName>($_location,
+ $res = $_qualCppClassName::create($_builder, $_location,
convertICmpPredicateFromLLVM(iCmpInst->getPredicate()), $lhs, $rhs);
}];
// Set the $predicate index to -1 to indicate there is no matching operand
@@ -217,7 +217,7 @@ def LLVM_FCmpOp : LLVM_ArithmeticCmpOp<"fcmp", [
}];
string mlirBuilder = [{
auto *fCmpInst = cast<llvm::FCmpInst>(inst);
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, convertFCmpPredicateFromLLVM(fCmpInst->getPredicate()), $lhs, $rhs);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
@@ -261,7 +261,7 @@ def LLVM_AllocaOp : LLVM_Op<"alloca",
Type allocatedType =
moduleImport.convertType(allocaInst->getAllocatedType());
unsigned alignment = allocaInst->getAlign().value();
- $res = $_builder.create<LLVM::AllocaOp>(
+ $res = LLVM::AllocaOp::create($_builder,
$_location, $_resultType, $arraySize,
alignment == 0 ? IntegerAttr() : $_builder.getI64IntegerAttr(alignment),
allocatedType, allocaInst->isUsedWithInAlloca());
@@ -440,7 +440,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
string mlirBuilder = [{
auto *loadInst = cast<llvm::LoadInst>(inst);
unsigned alignment = loadInst->getAlign().value();
- $res = $_builder.create<LLVM::LoadOp>($_location, $_resultType, $addr,
+ $res = LLVM::LoadOp::create($_builder, $_location, $_resultType, $addr,
alignment, loadInst->isVolatile(),
loadInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
loadInst->hasMetadata(llvm::LLVMContext::MD_invariant_load),
@@ -518,7 +518,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
string mlirBuilder = [{
auto *storeInst = cast<llvm::StoreInst>(inst);
unsigned alignment = storeInst->getAlign().value();
- $_op = $_builder.create<LLVM::StoreOp>($_location, $value, $addr,
+ $_op = LLVM::StoreOp::create($_builder, $_location, $value, $addr,
alignment, storeInst->isVolatile(),
storeInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
storeInst->hasMetadata(llvm::LLVMContext::MD_invariant_group),
@@ -547,7 +547,7 @@ class LLVM_CastOp<string mnemonic, string instName, Type type,
let assemblyFormat = "$arg attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- $res = $_builder.create<$_qualCppClassName>(
+ $res = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
}];
}
@@ -561,7 +561,7 @@ class LLVM_CastOpWithNNegFlag<string mnemonic, string instName, Type type,
let assemblyFormat = "(`nneg` $nonNeg^)? $arg attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
moduleImport.setNonNegFlag(inst, op);
$res = op;
@@ -578,7 +578,7 @@ class LLVM_CastOpWithOverflowFlag<string mnemonic, string instName, Type type,
let assemblyFormat = "$arg ($overflowFlags^)? attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
moduleImport.setIntegerOverflowFlags(inst, op);
$res = op;
@@ -602,7 +602,7 @@ class LLVM_DereferenceableCastOp<string mnemonic, string instName, Type type,
}
}];
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
$res = op;
}];
@@ -725,7 +725,7 @@ def LLVM_VaArgOp : LLVM_Op<"va_arg"> {
string llvmInstName = "VAArg";
string mlirBuilder = [{
- $res = $_builder.create<mlir::LLVM::VaArgOp>(
+ $res = mlir::LLVM::VaArgOp::create($_builder,
$_location, $_resultType, $arg);
}];
}
@@ -847,7 +847,7 @@ def LLVM_ExtractElementOp : LLVM_Op<"extractelement", [Pure,
$res = builder.CreateExtractElement($vector, $position);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::ExtractElementOp>(
+ $res = LLVM::ExtractElementOp::create($_builder,
$_location, $vector, $position);
}];
}
@@ -881,7 +881,7 @@ def LLVM_ExtractValueOp : LLVM_Op<"extractvalue", [Pure]> {
}];
string mlirBuilder = [{
auto *evInst = cast<llvm::ExtractValueInst>(inst);
- $res = $_builder.create<LLVM::ExtractValueOp>($_location,
+ $res = LLVM::ExtractValueOp::create($_builder, $_location,
$container, getPositionFromIndices(evInst->getIndices()));
}];
}
@@ -913,7 +913,7 @@ def LLVM_InsertElementOp : LLVM_Op<"insertelement", [Pure,
$res = builder.CreateInsertElement($vector, $value, $position);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::InsertElementOp>(
+ $res = LLVM::InsertElementOp::create($_builder,
$_location, $vector, $value, $position);
}];
}
@@ -945,7 +945,7 @@ def LLVM_InsertValueOp : LLVM_Op<
}];
string mlirBuilder = [{
auto *ivInst = cast<llvm::InsertValueInst>(inst);
- $res = $_builder.create<LLVM::InsertValueOp>($_location,
+ $res = LLVM::InsertValueOp::create($_builder, $_location,
$container, $value, getPositionFromIndices(ivInst->getIndices()));
}];
}
@@ -982,7 +982,7 @@ def LLVM_ShuffleVectorOp : LLVM_Op<"shufflevector",
string mlirBuilder = [{
auto *svInst = cast<llvm::ShuffleVectorInst>(inst);
SmallVector<int32_t> mask(svInst->getShuffleMask());
- $res = $_builder.create<LLVM::ShuffleVectorOp>(
+ $res = LLVM::ShuffleVectorOp::create($_builder,
$_location, $v1, $v2, mask);
}];
}
@@ -1003,7 +1003,7 @@ def LLVM_SelectOp
let assemblyFormat = "operands attr-dict `:` type($condition) `,` type($res)";
string llvmInstName = "Select";
string mlirBuilder = [{
- auto op = $_builder.create<LLVM::SelectOp>(
+ auto op = LLVM::SelectOp::create($_builder,
$_location, $_resultType, $condition, $trueValue, $falseValue);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
@@ -1017,7 +1017,7 @@ def LLVM_FreezeOp : LLVM_Op<"freeze", [Pure, SameOperandsAndResultType]> {
string llvmInstName = "Freeze";
string llvmBuilder = "$res = builder.CreateFreeze($val);";
string mlirBuilder = [{
- $res = $_builder.create<LLVM::FreezeOp>($_location, $val);
+ $res = LLVM::FreezeOp::create($_builder, $_location, $val);
}];
}
@@ -1108,7 +1108,7 @@ def LLVM_ReturnOp : LLVM_TerminatorOp<"return", [Pure, ReturnLike]> {
moduleImport.convertValues(llvmOperands);
if (failed(mlirOperands))
return failure();
- $_op = $_builder.create<LLVM::ReturnOp>($_location, *mlirOperands);
+ $_op = LLVM::ReturnOp::create($_builder, $_location, *mlirOperands);
}];
}
@@ -1120,7 +1120,7 @@ def LLVM_ResumeOp : LLVM_TerminatorOp<"resume"> {
string llvmInstName = "Resume";
string llvmBuilder = [{ builder.CreateResume($value); }];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::ResumeOp>($_location, $value);
+ $_op = LLVM::ResumeOp::create($_builder, $_location, $value);
}];
}
def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable"> {
@@ -1128,7 +1128,7 @@ def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable"> {
string llvmInstName = "Unreachable";
string llvmBuilder = [{ builder.CreateUnreachable(); }];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::UnreachableOp>($_location);
+ $_op = LLVM::UnreachableOp::create($_builder, $_location);
}];
}
@@ -2256,7 +2256,7 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
string mlirBuilder = [{
auto *atomicInst = cast<llvm::AtomicRMWInst>(inst);
unsigned alignment = atomicInst->getAlign().value();
- $res = $_builder.create<LLVM::AtomicRMWOp>($_location,
+ $res = LLVM::AtomicRMWOp::create($_builder, $_location,
convertAtomicBinOpFromLLVM(atomicInst->getOperation()), $ptr, $val,
convertAtomicOrderingFromLLVM(atomicInst->getOrdering()),
getLLVMSyncScope(atomicInst), alignment, atomicInst->isVolatile());
@@ -2311,7 +2311,7 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
string mlirBuilder = [{
auto *cmpXchgInst = cast<llvm::AtomicCmpXchgInst>(inst);
unsigned alignment = cmpXchgInst->getAlign().value();
- $res = $_builder.create<LLVM::AtomicCmpXchgOp>(
+ $res = LLVM::AtomicCmpXchgOp::create($_builder,
$_location, $ptr, $cmp, $val,
convertAtomicOrderingFromLLVM(cmpXchgInst->getSuccessOrdering()),
convertAtomicOrderingFromLLVM(cmpXchgInst->getFailureOrdering()),
@@ -2340,7 +2340,7 @@ def LLVM_FenceOp : LLVM_Op<"fence">, LLVM_MemOpPatterns {
}] # setSyncScopeCode;
string mlirBuilder = [{
llvm::FenceInst *fenceInst = cast<llvm::FenceInst>(inst);
- $_op = $_builder.create<LLVM::FenceOp>(
+ $_op = LLVM::FenceOp::create($_builder,
$_location,
convertAtomicOrderingFromLLVM(fenceInst->getOrdering()),
getLLVMSyncScope(fenceInst));
diff --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index c17ef1029faf6..894de4408c375 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -90,8 +90,8 @@ void PtxBuilder::insertValue(Value v, PTXRegisterMod itype) {
}
for (auto [idx, t] : llvm::enumerate(stype.getBody())) {
if (itype != PTXRegisterMod::Write) {
- Value extractValue = rewriter.create<LLVM::ExtractValueOp>(
- interfaceOp->getLoc(), v, idx);
+ Value extractValue = LLVM::ExtractValueOp::create(
+ rewriter, interfaceOp->getLoc(), v, idx);
addValue(extractValue);
}
if (itype == PTXRegisterMod::ReadWrite) {
@@ -132,8 +132,8 @@ LLVM::InlineAsmOp PtxBuilder::build() {
// Replace all % with $
llvm::replace(ptxInstruction, '%', '$');
- return rewriter.create<LLVM::InlineAsmOp>(
- interfaceOp->getLoc(),
+ return LLVM::InlineAsmOp::create(
+ rewriter, interfaceOp->getLoc(),
/*result types=*/resultTypes,
/*operands=*/ptxOperands,
/*asm_string=*/llvm::StringRef(ptxInstruction),
diff --git a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
index 89f765dacda35..feaffa34897b6 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
@@ -89,8 +89,8 @@ mlir::LLVM::lookupOrCreateFn(OpBuilder &b, Operation *moduleOp, StringRef name,
OpBuilder::InsertionGuard g(b);
assert(!moduleOp->getRegion(0).empty() && "expected non-empty region");
b.setInsertionPointToStart(&moduleOp->getRegion(0).front());
- auto funcOp = b.create<LLVM::LLVMFuncOp>(
- moduleOp->getLoc(), name,
+ auto funcOp = LLVM::LLVMFuncOp::create(
+ b, moduleOp->getLoc(), name,
LLVM::LLVMFunctionType::get(resultType, paramTypes, isVarArg));
if (symbolTables) {
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 4a1527cd0369f..bef60e7beda25 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -3384,7 +3384,7 @@ bool LLVM::ConstantOp::isBuildableWith(Attribute value, Type type) {
ConstantOp LLVM::ConstantOp::materialize(OpBuilder &builder, Attribute value,
Type type, Location loc) {
if (isBuildableWith(value, type))
- return builder.create<LLVM::ConstantOp>(loc, cast<TypedAttr>(value));
+ return LLVM::ConstantOp::create(builder, loc, cast<TypedAttr>(value));
return nullptr;
}
@@ -4350,13 +4350,13 @@ Operation *LLVMDialect::ma...
[truncated]
|
@llvm/pr-subscribers-mlir Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 43.98 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149667.diff 11 Files Affected:
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index cd8b68e5b1410..34f5125bf2d09 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -324,7 +324,7 @@ def LLVM_NoAliasScopeDeclOp
return success();
if (scopeAttrs->size() != 1)
return failure();
- $_op = $_builder.create<LLVM::NoAliasScopeDeclOp>(
+ $_op = LLVM::NoAliasScopeDeclOp::create($_builder,
$_location, (*scopeAttrs)[0]);
}];
let assemblyFormat = "$scope attr-dict";
@@ -468,7 +468,7 @@ class LLVM_ConstrainedIntr<string mnem, int numArgs,
$_builder.getNamedAttr($_qualCppClassName::getRoundingModeAttrName(),
roundingModeAttr));
}], true : "") # [{
- $res = $_builder.create<$_qualCppClassName>($_location,
+ $res = $_qualCppClassName::create($_builder, $_location,
$_resultType, mlirOperands, mlirAttrs);
}];
}
@@ -743,7 +743,7 @@ def LLVM_DbgLabelOp : LLVM_IntrOp<"dbg.label", [], [], [], 0> {
// Drop the intrinsic if the label translation fails due to cylic metadata.
if (!labelAttr)
return success();
- $_op = $_builder.create<$_qualCppClassName>($_location, labelAttr);
+ $_op = $_qualCppClassName::create($_builder, $_location, labelAttr);
}];
let assemblyFormat = "$label attr-dict";
}
@@ -883,7 +883,7 @@ def LLVM_MatrixColumnMajorLoadOp : LLVM_OneResultIntrOp<"matrix.column.major.loa
$columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixColumnMajorLoadOp>(
+ $res = LLVM::MatrixColumnMajorLoadOp::create($_builder,
$_location, $_resultType, $data, $stride,
$_int_attr($isVolatile), $_int_attr($rows), $_int_attr($columns));
}];
@@ -917,7 +917,7 @@ def LLVM_MatrixColumnMajorStoreOp : LLVM_ZeroResultIntrOp<"matrix.column.major.s
$rows, $columns);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::MatrixColumnMajorStoreOp>(
+ $_op = LLVM::MatrixColumnMajorStoreOp::create($_builder,
$_location, $matrix, $data, $stride,
$_int_attr($isVolatile), $_int_attr($rows), $_int_attr($columns));
}];
@@ -940,7 +940,7 @@ def LLVM_MatrixMultiplyOp : LLVM_OneResultIntrOp<"matrix.multiply"> {
$rhs_columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixMultiplyOp>(
+ $res = LLVM::MatrixMultiplyOp::create($_builder,
$_location, $_resultType, $lhs, $rhs,
$_int_attr($lhs_rows), $_int_attr($lhs_columns), $_int_attr($rhs_columns));
}];
@@ -960,7 +960,7 @@ def LLVM_MatrixTransposeOp : LLVM_OneResultIntrOp<"matrix.transpose"> {
$matrix, $rows, $columns);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::MatrixTransposeOp>(
+ $res = LLVM::MatrixTransposeOp::create($_builder,
$_location, $_resultType, $matrix,
$_int_attr($rows), $_int_attr($columns));
}];
@@ -997,7 +997,7 @@ def LLVM_MaskedLoadOp : LLVM_OneResultIntrOp<"masked.load"> {
string mlirBuilder = [{
auto *intrinInst = dyn_cast<llvm::IntrinsicInst>(inst);
bool nontemporal = intrinInst->hasMetadata(llvm::LLVMContext::MD_nontemporal);
- $res = $_builder.create<LLVM::MaskedLoadOp>($_location,
+ $res = LLVM::MaskedLoadOp::create($_builder, $_location,
$_resultType, $data, $mask, $pass_thru, $_int_attr($alignment),
nontemporal ? $_builder.getUnitAttr() : nullptr);
}];
@@ -1017,7 +1017,7 @@ def LLVM_MaskedStoreOp : LLVM_ZeroResultIntrOp<"masked.store"> {
$value, $data, llvm::Align($alignment), $mask);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::MaskedStoreOp>($_location,
+ $_op = LLVM::MaskedStoreOp::create($_builder, $_location,
$value, $data, $mask, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 1, 3, 2];
@@ -1040,7 +1040,7 @@ def LLVM_masked_gather : LLVM_OneResultIntrOp<"masked.gather"> {
$_resultType, $ptrs, llvm::Align($alignment), $mask, $pass_thru[0]);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::masked_gather>($_location,
+ $res = LLVM::masked_gather::create($_builder, $_location,
$_resultType, $ptrs, $mask, $pass_thru, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 2, 3, 1];
@@ -1061,7 +1061,7 @@ def LLVM_masked_scatter : LLVM_ZeroResultIntrOp<"masked.scatter"> {
$value, $ptrs, llvm::Align($alignment), $mask);
}];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::masked_scatter>($_location,
+ $_op = LLVM::masked_scatter::create($_builder, $_location,
$value, $ptrs, $mask, $_int_attr($alignment));
}];
list<int> llvmArgIndices = [0, 1, 3, 2];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
index e08c7b7969330..e845ea9f1e604 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
@@ -363,7 +363,7 @@ class LLVM_IntrOpBase<Dialect dialect, string opName, string enumName,
}
SmallVector<Type> resultTypes =
}] # !if(!gt(numResults, 0), "{$_resultType};", "{};") # [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, resultTypes, mlirOperands, mlirAttrs);
}];
string baseMlirBuilderCoda = !if(!gt(numResults, 0), "$res = op;", "$_op = op;");
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 4a9bc90e43d96..51004f592eca4 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -53,7 +53,7 @@ class LLVM_IntArithmeticOp<string mnemonic, string instName,
LLVM_ArithmeticOpBase<AnySignlessInteger, mnemonic, instName, traits> {
let arguments = commonArgs;
string mlirBuilder = [{
- $res = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ $res = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
}];
}
class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
@@ -64,7 +64,7 @@ class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, iofArg);
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setIntegerOverflowFlags(inst, op);
$res = op;
}];
@@ -82,7 +82,7 @@ class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, (ins UnitAttr:$isExact));
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setExactFlag(inst, op);
$res = op;
}];
@@ -100,7 +100,7 @@ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
let arguments = !con(commonArgs, (ins UnitAttr:$isDisjoint));
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setDisjointFlag(inst, op);
$res = op;
}];
@@ -121,7 +121,7 @@ class LLVM_FloatArithmeticOp<string mnemonic, string instName,
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
}];
@@ -141,7 +141,7 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
let assemblyFormat = "$operand attr-dict `:` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>($_location, $operand);
+ auto op = $_qualCppClassName::create($_builder, $_location, $operand);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
}];
@@ -193,7 +193,7 @@ def LLVM_ICmpOp : LLVM_ArithmeticCmpOp<"icmp", [Pure]> {
}];
string mlirBuilder = [{
auto *iCmpInst = cast<llvm::ICmpInst>(inst);
- $res = $_builder.create<$_qualCppClassName>($_location,
+ $res = $_qualCppClassName::create($_builder, $_location,
convertICmpPredicateFromLLVM(iCmpInst->getPredicate()), $lhs, $rhs);
}];
// Set the $predicate index to -1 to indicate there is no matching operand
@@ -217,7 +217,7 @@ def LLVM_FCmpOp : LLVM_ArithmeticCmpOp<"fcmp", [
}];
string mlirBuilder = [{
auto *fCmpInst = cast<llvm::FCmpInst>(inst);
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, convertFCmpPredicateFromLLVM(fCmpInst->getPredicate()), $lhs, $rhs);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
@@ -261,7 +261,7 @@ def LLVM_AllocaOp : LLVM_Op<"alloca",
Type allocatedType =
moduleImport.convertType(allocaInst->getAllocatedType());
unsigned alignment = allocaInst->getAlign().value();
- $res = $_builder.create<LLVM::AllocaOp>(
+ $res = LLVM::AllocaOp::create($_builder,
$_location, $_resultType, $arraySize,
alignment == 0 ? IntegerAttr() : $_builder.getI64IntegerAttr(alignment),
allocatedType, allocaInst->isUsedWithInAlloca());
@@ -440,7 +440,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
string mlirBuilder = [{
auto *loadInst = cast<llvm::LoadInst>(inst);
unsigned alignment = loadInst->getAlign().value();
- $res = $_builder.create<LLVM::LoadOp>($_location, $_resultType, $addr,
+ $res = LLVM::LoadOp::create($_builder, $_location, $_resultType, $addr,
alignment, loadInst->isVolatile(),
loadInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
loadInst->hasMetadata(llvm::LLVMContext::MD_invariant_load),
@@ -518,7 +518,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
string mlirBuilder = [{
auto *storeInst = cast<llvm::StoreInst>(inst);
unsigned alignment = storeInst->getAlign().value();
- $_op = $_builder.create<LLVM::StoreOp>($_location, $value, $addr,
+ $_op = LLVM::StoreOp::create($_builder, $_location, $value, $addr,
alignment, storeInst->isVolatile(),
storeInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
storeInst->hasMetadata(llvm::LLVMContext::MD_invariant_group),
@@ -547,7 +547,7 @@ class LLVM_CastOp<string mnemonic, string instName, Type type,
let assemblyFormat = "$arg attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- $res = $_builder.create<$_qualCppClassName>(
+ $res = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
}];
}
@@ -561,7 +561,7 @@ class LLVM_CastOpWithNNegFlag<string mnemonic, string instName, Type type,
let assemblyFormat = "(`nneg` $nonNeg^)? $arg attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
moduleImport.setNonNegFlag(inst, op);
$res = op;
@@ -578,7 +578,7 @@ class LLVM_CastOpWithOverflowFlag<string mnemonic, string instName, Type type,
let assemblyFormat = "$arg ($overflowFlags^)? attr-dict `:` type($arg) `to` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
moduleImport.setIntegerOverflowFlags(inst, op);
$res = op;
@@ -602,7 +602,7 @@ class LLVM_DereferenceableCastOp<string mnemonic, string instName, Type type,
}
}];
string mlirBuilder = [{
- auto op = $_builder.create<$_qualCppClassName>(
+ auto op = $_qualCppClassName::create($_builder,
$_location, $_resultType, $arg);
$res = op;
}];
@@ -725,7 +725,7 @@ def LLVM_VaArgOp : LLVM_Op<"va_arg"> {
string llvmInstName = "VAArg";
string mlirBuilder = [{
- $res = $_builder.create<mlir::LLVM::VaArgOp>(
+ $res = mlir::LLVM::VaArgOp::create($_builder,
$_location, $_resultType, $arg);
}];
}
@@ -847,7 +847,7 @@ def LLVM_ExtractElementOp : LLVM_Op<"extractelement", [Pure,
$res = builder.CreateExtractElement($vector, $position);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::ExtractElementOp>(
+ $res = LLVM::ExtractElementOp::create($_builder,
$_location, $vector, $position);
}];
}
@@ -881,7 +881,7 @@ def LLVM_ExtractValueOp : LLVM_Op<"extractvalue", [Pure]> {
}];
string mlirBuilder = [{
auto *evInst = cast<llvm::ExtractValueInst>(inst);
- $res = $_builder.create<LLVM::ExtractValueOp>($_location,
+ $res = LLVM::ExtractValueOp::create($_builder, $_location,
$container, getPositionFromIndices(evInst->getIndices()));
}];
}
@@ -913,7 +913,7 @@ def LLVM_InsertElementOp : LLVM_Op<"insertelement", [Pure,
$res = builder.CreateInsertElement($vector, $value, $position);
}];
string mlirBuilder = [{
- $res = $_builder.create<LLVM::InsertElementOp>(
+ $res = LLVM::InsertElementOp::create($_builder,
$_location, $vector, $value, $position);
}];
}
@@ -945,7 +945,7 @@ def LLVM_InsertValueOp : LLVM_Op<
}];
string mlirBuilder = [{
auto *ivInst = cast<llvm::InsertValueInst>(inst);
- $res = $_builder.create<LLVM::InsertValueOp>($_location,
+ $res = LLVM::InsertValueOp::create($_builder, $_location,
$container, $value, getPositionFromIndices(ivInst->getIndices()));
}];
}
@@ -982,7 +982,7 @@ def LLVM_ShuffleVectorOp : LLVM_Op<"shufflevector",
string mlirBuilder = [{
auto *svInst = cast<llvm::ShuffleVectorInst>(inst);
SmallVector<int32_t> mask(svInst->getShuffleMask());
- $res = $_builder.create<LLVM::ShuffleVectorOp>(
+ $res = LLVM::ShuffleVectorOp::create($_builder,
$_location, $v1, $v2, mask);
}];
}
@@ -1003,7 +1003,7 @@ def LLVM_SelectOp
let assemblyFormat = "operands attr-dict `:` type($condition) `,` type($res)";
string llvmInstName = "Select";
string mlirBuilder = [{
- auto op = $_builder.create<LLVM::SelectOp>(
+ auto op = LLVM::SelectOp::create($_builder,
$_location, $_resultType, $condition, $trueValue, $falseValue);
moduleImport.setFastmathFlagsAttr(inst, op);
$res = op;
@@ -1017,7 +1017,7 @@ def LLVM_FreezeOp : LLVM_Op<"freeze", [Pure, SameOperandsAndResultType]> {
string llvmInstName = "Freeze";
string llvmBuilder = "$res = builder.CreateFreeze($val);";
string mlirBuilder = [{
- $res = $_builder.create<LLVM::FreezeOp>($_location, $val);
+ $res = LLVM::FreezeOp::create($_builder, $_location, $val);
}];
}
@@ -1108,7 +1108,7 @@ def LLVM_ReturnOp : LLVM_TerminatorOp<"return", [Pure, ReturnLike]> {
moduleImport.convertValues(llvmOperands);
if (failed(mlirOperands))
return failure();
- $_op = $_builder.create<LLVM::ReturnOp>($_location, *mlirOperands);
+ $_op = LLVM::ReturnOp::create($_builder, $_location, *mlirOperands);
}];
}
@@ -1120,7 +1120,7 @@ def LLVM_ResumeOp : LLVM_TerminatorOp<"resume"> {
string llvmInstName = "Resume";
string llvmBuilder = [{ builder.CreateResume($value); }];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::ResumeOp>($_location, $value);
+ $_op = LLVM::ResumeOp::create($_builder, $_location, $value);
}];
}
def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable"> {
@@ -1128,7 +1128,7 @@ def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable"> {
string llvmInstName = "Unreachable";
string llvmBuilder = [{ builder.CreateUnreachable(); }];
string mlirBuilder = [{
- $_op = $_builder.create<LLVM::UnreachableOp>($_location);
+ $_op = LLVM::UnreachableOp::create($_builder, $_location);
}];
}
@@ -2256,7 +2256,7 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
string mlirBuilder = [{
auto *atomicInst = cast<llvm::AtomicRMWInst>(inst);
unsigned alignment = atomicInst->getAlign().value();
- $res = $_builder.create<LLVM::AtomicRMWOp>($_location,
+ $res = LLVM::AtomicRMWOp::create($_builder, $_location,
convertAtomicBinOpFromLLVM(atomicInst->getOperation()), $ptr, $val,
convertAtomicOrderingFromLLVM(atomicInst->getOrdering()),
getLLVMSyncScope(atomicInst), alignment, atomicInst->isVolatile());
@@ -2311,7 +2311,7 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
string mlirBuilder = [{
auto *cmpXchgInst = cast<llvm::AtomicCmpXchgInst>(inst);
unsigned alignment = cmpXchgInst->getAlign().value();
- $res = $_builder.create<LLVM::AtomicCmpXchgOp>(
+ $res = LLVM::AtomicCmpXchgOp::create($_builder,
$_location, $ptr, $cmp, $val,
convertAtomicOrderingFromLLVM(cmpXchgInst->getSuccessOrdering()),
convertAtomicOrderingFromLLVM(cmpXchgInst->getFailureOrdering()),
@@ -2340,7 +2340,7 @@ def LLVM_FenceOp : LLVM_Op<"fence">, LLVM_MemOpPatterns {
}] # setSyncScopeCode;
string mlirBuilder = [{
llvm::FenceInst *fenceInst = cast<llvm::FenceInst>(inst);
- $_op = $_builder.create<LLVM::FenceOp>(
+ $_op = LLVM::FenceOp::create($_builder,
$_location,
convertAtomicOrderingFromLLVM(fenceInst->getOrdering()),
getLLVMSyncScope(fenceInst));
diff --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index c17ef1029faf6..894de4408c375 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -90,8 +90,8 @@ void PtxBuilder::insertValue(Value v, PTXRegisterMod itype) {
}
for (auto [idx, t] : llvm::enumerate(stype.getBody())) {
if (itype != PTXRegisterMod::Write) {
- Value extractValue = rewriter.create<LLVM::ExtractValueOp>(
- interfaceOp->getLoc(), v, idx);
+ Value extractValue = LLVM::ExtractValueOp::create(
+ rewriter, interfaceOp->getLoc(), v, idx);
addValue(extractValue);
}
if (itype == PTXRegisterMod::ReadWrite) {
@@ -132,8 +132,8 @@ LLVM::InlineAsmOp PtxBuilder::build() {
// Replace all % with $
llvm::replace(ptxInstruction, '%', '$');
- return rewriter.create<LLVM::InlineAsmOp>(
- interfaceOp->getLoc(),
+ return LLVM::InlineAsmOp::create(
+ rewriter, interfaceOp->getLoc(),
/*result types=*/resultTypes,
/*operands=*/ptxOperands,
/*asm_string=*/llvm::StringRef(ptxInstruction),
diff --git a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
index 89f765dacda35..feaffa34897b6 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
@@ -89,8 +89,8 @@ mlir::LLVM::lookupOrCreateFn(OpBuilder &b, Operation *moduleOp, StringRef name,
OpBuilder::InsertionGuard g(b);
assert(!moduleOp->getRegion(0).empty() && "expected non-empty region");
b.setInsertionPointToStart(&moduleOp->getRegion(0).front());
- auto funcOp = b.create<LLVM::LLVMFuncOp>(
- moduleOp->getLoc(), name,
+ auto funcOp = LLVM::LLVMFuncOp::create(
+ b, moduleOp->getLoc(), name,
LLVM::LLVMFunctionType::get(resultType, paramTypes, isVarArg));
if (symbolTables) {
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 4a1527cd0369f..bef60e7beda25 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -3384,7 +3384,7 @@ bool LLVM::ConstantOp::isBuildableWith(Attribute value, Type type) {
ConstantOp LLVM::ConstantOp::materialize(OpBuilder &builder, Attribute value,
Type type, Location loc) {
if (isBuildableWith(value, type))
- return builder.create<LLVM::ConstantOp>(loc, cast<TypedAttr>(value));
+ return LLVM::ConstantOp::create(builder, loc, cast<TypedAttr>(value));
return nullptr;
}
@@ -4350,13 +4350,13 @@ Operation *LLVMDialect::ma...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
76990ea
to
c559c3c
Compare
See llvm#147168 for more info.
c559c3c
to
40c7073
Compare
Taken from git history: 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (#149656)
The update is most likely not what someone wants when looking at the blame for one of these lines. Taken from git history: ``` 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (#149656) ```
See llvm#147168 for more info.
The update is most likely not what someone wants when looking at the blame for one of these lines. Taken from git history: ``` 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (llvm#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (llvm#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (llvm#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (llvm#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (llvm#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (llvm#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (llvm#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (llvm#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (llvm#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (llvm#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (llvm#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (llvm#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (llvm#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (llvm#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (llvm#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (llvm#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (llvm#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (llvm#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (llvm#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (llvm#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (llvm#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (llvm#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (llvm#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (llvm#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (llvm#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (llvm#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (llvm#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (llvm#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (llvm#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (llvm#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (llvm#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (llvm#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (llvm#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (llvm#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (llvm#149656) ```
See #147168 for more info.