Skip to content

Commit bef9067

Browse files
rayngunsramasit
authored andcommitted
Revert "[mlir][Symbol] Add verification that symbol's parent is a SymbolTable (#80590)"
This reverts commit 7d055af.
1 parent f3910e9 commit bef9067

File tree

13 files changed

+85
-68
lines changed

13 files changed

+85
-68
lines changed

mlir/include/mlir/IR/SymbolInterfaces.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
171171
if (concreteOp.isDeclaration() && concreteOp.isPublic())
172172
return concreteOp.emitOpError("symbol declaration cannot have public "
173173
"visibility");
174-
auto parent = $_op->getParentOp();
175-
if (parent && !parent->hasTrait<OpTrait::SymbolTable>() && parent->isRegistered()) {
176-
return concreteOp.emitOpError("symbol's parent must have the SymbolTable "
177-
"trait");
178-
}
179174
return success();
180175
}];
181176

mlir/test/Dialect/LLVMIR/global.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ llvm.mlir.global internal constant @constant(37.0) : !llvm.label
132132
// -----
133133

134134
func.func @foo() {
135-
// expected-error @+1 {{op symbol's parent must have the SymbolTable trait}}
135+
// expected-error @+1 {{must appear at the module level}}
136136
llvm.mlir.global internal @bar(42) : i32
137137

138138
return

mlir/test/Dialect/Linalg/transform-op-replace.mlir

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ module attributes {transform.with_named_sequence} {
1212
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
1313
%0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op
1414
transform.structured.replace %0 {
15-
builtin.module {
16-
func.func @foo() {
17-
"dummy_op"() : () -> ()
18-
}
15+
func.func @foo() {
16+
"dummy_op"() : () -> ()
1917
}
2018
} : (!transform.any_op) -> !transform.any_op
2119
transform.yield

mlir/test/Dialect/Transform/ops-invalid.mlir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,10 @@ module {
482482
// -----
483483

484484
module attributes { transform.with_named_sequence} {
485+
// expected-note @below {{ancestor transform op}}
485486
transform.sequence failures(suppress) {
486487
^bb0(%arg0: !transform.any_op):
487-
// expected-error @below {{op symbol's parent must have the SymbolTable trai}}
488+
// expected-error @below {{cannot be defined inside another transform op}}
488489
transform.named_sequence @nested() {
489490
transform.yield
490491
}

mlir/test/IR/invalid-func-op.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func.func @func_op() {
3131
// -----
3232

3333
func.func @func_op() {
34-
// expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}
34+
// expected-error@+1 {{entry block must have 1 arguments to match function signature}}
3535
func.func @mixed_named_arguments(f32) {
3636
^entry:
3737
return
@@ -42,7 +42,7 @@ func.func @func_op() {
4242
// -----
4343

4444
func.func @func_op() {
45-
// expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}
45+
// expected-error@+1 {{type of entry block argument #0('i32') must match the type of the corresponding argument in function signature('f32')}}
4646
func.func @mixed_named_arguments(f32) {
4747
^entry(%arg : i32):
4848
return

mlir/test/IR/region.mlir

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,18 @@ func.func @named_region_has_wrong_number_of_blocks() {
8787
// CHECK: test.single_no_terminator_op
8888
"test.single_no_terminator_op"() (
8989
{
90-
%foo = arith.constant 1 : i32
90+
func.func @foo1() { return }
91+
func.func @foo2() { return }
9192
}
9293
) : () -> ()
9394

9495
// CHECK: test.variadic_no_terminator_op
9596
"test.variadic_no_terminator_op"() (
9697
{
97-
%foo = arith.constant 1 : i32
98+
func.func @foo1() { return }
9899
},
99100
{
100-
%bar = arith.constant 1 : i32
101+
func.func @foo2() { return }
101102
}
102103
) : () -> ()
103104

mlir/test/IR/traits.mlir

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,15 @@ func.func @failedHasDominanceScopeOutsideDominanceFreeScope() -> () {
591591

592592
// Ensure that SSACFG regions of operations in GRAPH regions are
593593
// checked for dominance
594-
func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () {
594+
func.func @illegalInsideDominanceFreeScope() -> () {
595595
test.graph_region {
596-
scf.if %cond {
596+
func.func @test() -> i1 {
597+
^bb1:
597598
// expected-error @+1 {{operand #0 does not dominate this use}}
598599
%2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
599600
// expected-note @+1 {{operand defined here}}
600-
%1 = "baz"(%2#0) : (i1) -> (i64)
601+
%1 = "baz"(%2#0) : (i1) -> (i64)
602+
return %2#1 : i1
601603
}
602604
"terminator"() : () -> ()
603605
}
@@ -608,21 +610,20 @@ func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () {
608610

609611
// Ensure that SSACFG regions of operations in GRAPH regions are
610612
// checked for dominance
611-
func.func @illegalCFGInsideDominanceFreeScope(%cond: i1) -> () {
613+
func.func @illegalCDFGInsideDominanceFreeScope() -> () {
612614
test.graph_region {
613-
scf.if %cond {
614-
"test.ssacfg_region"() ({
615-
^bb1:
616-
// expected-error @+1 {{operand #0 does not dominate this use}}
617-
%2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
618-
cf.br ^bb4
619-
^bb2:
620-
cf.br ^bb2
621-
^bb4:
622-
%1 = "foo"() : ()->i64 // expected-note {{operand defined here}}
623-
}) : () -> ()
615+
func.func @test() -> i1 {
616+
^bb1:
617+
// expected-error @+1 {{operand #0 does not dominate this use}}
618+
%2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
619+
cf.br ^bb4
620+
^bb2:
621+
cf.br ^bb2
622+
^bb4:
623+
%1 = "foo"() : ()->i64 // expected-note {{operand defined here}}
624+
return %2#1 : i1
624625
}
625-
"terminator"() : () -> ()
626+
"terminator"() : () -> ()
626627
}
627628
return
628629
}

mlir/test/Transforms/canonicalize-dce.mlir

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ func.func @f(%arg0: f32, %pred: i1) {
7777

7878
// Test case: Recursively DCE into enclosed regions.
7979

80-
// CHECK: func.func @f(%arg0: f32)
81-
// CHECK-NOT: arith.addf
80+
// CHECK: func @f(%arg0: f32)
81+
// CHECK-NEXT: func @g(%arg1: f32)
82+
// CHECK-NEXT: return
8283

8384
func.func @f(%arg0: f32) {
84-
"test.region"() (
85-
{
86-
%0 = "arith.addf"(%arg0, %arg0) : (f32, f32) -> f32
87-
}
88-
) : () -> ()
85+
func.func @g(%arg1: f32) {
86+
%0 = "arith.addf"(%arg1, %arg1) : (f32, f32) -> f32
87+
return
88+
}
8989
return
9090
}
9191

mlir/test/Transforms/canonicalize.mlir

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,16 @@ func.func @write_only_alloca_fold(%v: f32) {
429429
// CHECK-LABEL: func @dead_block_elim
430430
func.func @dead_block_elim() {
431431
// CHECK-NOT: ^bb
432-
builtin.module {
433-
func.func @nested() {
434-
return
432+
func.func @nested() {
433+
return
435434

436-
^bb1:
437-
return
438-
}
435+
^bb1:
436+
return
439437
}
440438
return
439+
440+
^bb1:
441+
return
441442
}
442443

443444
// CHECK-LABEL: func @dyn_shape_fold(%arg0: index, %arg1: index)

mlir/test/Transforms/constant-fold.mlir

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,15 +794,12 @@ func.func @cmpf_inf() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1
794794

795795
// CHECK-LABEL: func @nested_isolated_region
796796
func.func @nested_isolated_region() {
797-
// CHECK-NEXT: builtin.module {
798797
// CHECK-NEXT: func @isolated_op
799798
// CHECK-NEXT: arith.constant 2
800-
builtin.module {
801-
func.func @isolated_op() {
802-
%0 = arith.constant 1 : i32
803-
%2 = arith.addi %0, %0 : i32
804-
"foo.yield"(%2) : (i32) -> ()
805-
}
799+
func.func @isolated_op() {
800+
%0 = arith.constant 1 : i32
801+
%2 = arith.addi %0, %0 : i32
802+
"foo.yield"(%2) : (i32) -> ()
806803
}
807804

808805
// CHECK: "foo.unknown_region"

0 commit comments

Comments
 (0)