-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] notify insertion of parent op first when cloning (#73806)
When cloning an operation with a region, the builder was currently notifying about the insertion of the cloned operations inside the region before the cloned operation itself. When using cloning inside rewrite pass, this could cause issues if a pattern is expected to be applied on a cloned parent operation before trying to apply patterns on the cloned operations it contains (the patterns are attempted in order of notifications for the cloned operations).
- Loading branch information
1 parent
d55692d
commit 5a4ca51
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.module(func.func(test-clone))" -split-input-file | ||
// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.module(func.func(test-clone))" | FileCheck %s | ||
|
||
module { | ||
func.func @fixpoint(%arg1 : i32) -> i32 { | ||
%r = "test.use"(%arg1) ({ | ||
"test.yield"(%arg1) : (i32) -> () | ||
%r2 = "test.use2"(%arg1) ({ | ||
"test.yield2"(%arg1) : (i32) -> () | ||
}) : (i32) -> i32 | ||
"test.yield"(%r2) : (i32) -> () | ||
}) : (i32) -> i32 | ||
return %r : i32 | ||
} | ||
} | ||
|
||
// CHECK: notifyOperationInserted: test.use | ||
// CHECK-NEXT: notifyOperationInserted: test.use2 | ||
// CHECK-NEXT: notifyOperationInserted: test.yield2 | ||
// CHECK-NEXT: notifyOperationInserted: test.yield | ||
// CHECK-NEXT: notifyOperationInserted: func.return | ||
|
||
// CHECK: func @fixpoint(%[[arg0:.+]]: i32) -> i32 { | ||
// CHECK-NEXT: %[[i0:.+]] = "test.use"(%[[arg0]]) ({ | ||
// CHECK-NEXT: "test.yield"(%arg0) : (i32) -> () | ||
// CHECK-NEXT: %[[r2:.+]] = "test.use2"(%[[arg0]]) ({ | ||
// CHECK-NEXT: "test.yield2"(%[[arg0]]) : (i32) -> () | ||
// CHECK-NEXT: }) : (i32) -> i32 | ||
// CHECK-NEXT: "test.yield"(%[[r2]]) : (i32) -> () | ||
// CHECK-NEXT: }) : (i32) -> i32 | ||
// CHECK-NEXT: %[[i1:.+]] = "test.use"(%[[i0]]) ({ | ||
// CHECK-NEXT: "test.yield"(%[[i0]]) : (i32) -> () | ||
// CHECK-NEXT: %[[r2:.+]] = "test.use2"(%[[i0]]) ({ | ||
// CHECK-NEXT: "test.yield2"(%[[i0]]) : (i32) -> () | ||
// CHECK-NEXT: }) : (i32) -> i32 | ||
// CHECK-NEXT: "test.yield"(%[[r2]]) : (i32) -> () | ||
// CHECK-NEXT: }) : (i32) -> i32 | ||
// CHECK-NEXT: return %[[i1]] : i32 | ||
// CHECK-NEXT: } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters