[Mlir-commits] [mlir] 42e9af9 - [mlir] Rename to avoid overlap in accessor prefixing
Jacques Pienaar
llvmlistbot at llvm.org
Sun Oct 24 18:17:26 PDT 2021
Author: Jacques Pienaar
Date: 2021-10-24T18:17:09-07:00
New Revision: 42e9af9e8f48151f74e6e0825db9a6c04853ee20
URL: https://github.com/llvm/llvm-project/commit/42e9af9e8f48151f74e6e0825db9a6c04853ee20
DIFF: https://github.com/llvm/llvm-project/commit/42e9af9e8f48151f74e6e0825db9a6c04853ee20.diff
LOG: [mlir] Rename to avoid overlap in accessor prefixing
Split out renaming from D112383 into standalone change.
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/test/Dialect/LLVMIR/global.mlir
mlir/test/Target/LLVMIR/llvmir.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 1e41587404c67..99d0a1fc69e23 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -443,7 +443,7 @@ def LLVM_InvokeOp : LLVM_Op<"invoke", [
DeclareOpInterfaceMethods<BranchOpInterface>,
Terminator]> {
let arguments = (ins OptionalAttr<FlatSymbolRefAttr>:$callee,
- Variadic<LLVM_Type>:$operands,
+ Variadic<LLVM_Type>:$callee_operands,
Variadic<LLVM_Type>:$normalDestOperands,
Variadic<LLVM_Type>:$unwindDestOperands);
let results = (outs Variadic<LLVM_Type>);
@@ -1006,7 +1006,7 @@ def LLVM_AccessGroupMetadataOp : LLVM_Op<"access_group", [
def LLVM_GlobalOp : LLVM_Op<"mlir.global",
[IsolatedFromAbove, SingleBlockImplicitTerminator<"ReturnOp">, Symbol]> {
let arguments = (ins
- TypeAttr:$type,
+ TypeAttr:$global_type,
UnitAttr:$constant,
StrAttr:$sym_name,
Linkage:$linkage,
@@ -1128,7 +1128,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
let extraClassDeclaration = [{
/// Return the LLVM type of the global.
Type getType() {
- return type();
+ return global_type();
}
/// Return the initializer attribute if it exists, or a null attribute.
Attribute getValueOrNull() {
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index 4154a6f6614b1..ba8f03e899cd1 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -295,12 +295,15 @@ def GenericAtomicRMWOp : Std_Op<"generic_atomic_rmw", [
let results = (outs
AnyTypeOf<[AnySignlessInteger, AnyFloat]>:$result);
- let regions = (region AnyRegion:$body);
+ let regions = (region AnyRegion);
let skipDefaultBuilders = 1;
let builders = [OpBuilder<(ins "Value":$memref, "ValueRange":$ivs)>];
let extraClassDeclaration = [{
+ // TODO: remove post migrating callers.
+ Region &body() { return getRegion(); }
+
// The value stored in memref[ivs].
Value getCurrentValue() {
return body().getArgument(0);
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2b5259b3447fe..4abf1eff86147 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -1386,7 +1386,7 @@ void GlobalOp::build(OpBuilder &builder, OperationState &result, Type type,
bool dsoLocal, ArrayRef<NamedAttribute> attrs) {
result.addAttribute(SymbolTable::getSymbolAttrName(),
builder.getStringAttr(name));
- result.addAttribute("type", TypeAttr::get(type));
+ result.addAttribute("global_type", TypeAttr::get(type));
if (isConstant)
result.addAttribute("constant", builder.getUnitAttr());
if (value)
@@ -1426,14 +1426,14 @@ static void printGlobalOp(OpAsmPrinter &p, GlobalOp op) {
// default syntax here, even though it is an inherent attribute
// (as defined in https://mlir.llvm.org/docs/LangRef/#attributes)
p.printOptionalAttrDict(op->getAttrs(),
- {SymbolTable::getSymbolAttrName(), "type", "constant",
- "value", getLinkageAttrName(),
+ {SymbolTable::getSymbolAttrName(), "global_type",
+ "constant", "value", getLinkageAttrName(),
getUnnamedAddrAttrName()});
// Print the trailing type unless it's a string global.
if (op.getValueOrNull().dyn_cast_or_null<StringAttr>())
return;
- p << " : " << op.type();
+ p << " : " << op.global_type();
Region &initializer = op.getInitializerRegion();
if (!initializer.empty())
@@ -1546,7 +1546,7 @@ static ParseResult parseGlobalOp(OpAsmParser &parser, OperationState &result) {
return failure();
}
- result.addAttribute("type", TypeAttr::get(types[0]));
+ result.addAttribute("global_type", TypeAttr::get(types[0]));
return success();
}
diff --git a/mlir/test/Dialect/LLVMIR/global.mlir b/mlir/test/Dialect/LLVMIR/global.mlir
index f9109fae98d8b..fd357a718c36c 100644
--- a/mlir/test/Dialect/LLVMIR/global.mlir
+++ b/mlir/test/Dialect/LLVMIR/global.mlir
@@ -85,7 +85,7 @@ llvm.mlir.global internal constant @sectionvar("teststring") {section = ".mysec
// -----
-// expected-error @+1 {{requires attribute 'type'}}
+// expected-error @+1 {{requires attribute 'global_type'}}
"llvm.mlir.global"() ({}) {sym_name = "foo", constant, value = 42 : i64} : () -> ()
// -----
@@ -96,12 +96,12 @@ llvm.mlir.global internal constant @constant(37.0) : !llvm.label
// -----
// expected-error @+1 {{'addr_space' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative}}
-"llvm.mlir.global"() ({}) {sym_name = "foo", type = i64, value = 42 : i64, addr_space = -1 : i32, linkage = #llvm.linkage<private>} : () -> ()
+"llvm.mlir.global"() ({}) {sym_name = "foo", global_type = i64, value = 42 : i64, addr_space = -1 : i32, linkage = #llvm.linkage<private>} : () -> ()
// -----
// expected-error @+1 {{'addr_space' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative}}
-"llvm.mlir.global"() ({}) {sym_name = "foo", type = i64, value = 42 : i64, addr_space = 1.0 : f32, linkage = #llvm.linkage<private>} : () -> ()
+"llvm.mlir.global"() ({}) {sym_name = "foo", global_type = i64, value = 42 : i64, addr_space = 1.0 : f32, linkage = #llvm.linkage<private>} : () -> ()
// -----
diff --git a/mlir/test/Target/LLVMIR/llvmir.mlir b/mlir/test/Target/LLVMIR/llvmir.mlir
index 2d1af3a30d0c8..e16c579c12aa9 100644
--- a/mlir/test/Target/LLVMIR/llvmir.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir.mlir
@@ -1,7 +1,7 @@
// RUN: mlir-translate -mlir-to-llvmir -split-input-file %s | FileCheck %s
// CHECK: @global_aligned32 = private global i64 42, align 32
-"llvm.mlir.global"() ({}) {sym_name = "global_aligned32", type = i64, value = 42 : i64, linkage = #llvm.linkage<private>, alignment = 32} : () -> ()
+"llvm.mlir.global"() ({}) {sym_name = "global_aligned32", global_type = i64, value = 42 : i64, linkage = #llvm.linkage<private>, alignment = 32} : () -> ()
// CHECK: @global_aligned64 = private global i64 42, align 64
llvm.mlir.global private @global_aligned64(42 : i64) {alignment = 64 : i64} : i64
More information about the Mlir-commits
mailing list