Skip to content

Commit 5edd79f

Browse files
committed
Revert "[MLIR][SCF] Add for-to-while loop transformation pass"
This reverts commit 644b55d. The added test is failing the bots.
1 parent f18f1ab commit 5edd79f

File tree

5 files changed

+0
-297
lines changed

5 files changed

+0
-297
lines changed

mlir/include/mlir/Dialect/SCF/Passes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ createParallelLoopTilingPass(llvm::ArrayRef<int64_t> tileSize = {},
5252
/// loop range.
5353
std::unique_ptr<Pass> createForLoopRangeFoldingPass();
5454

55-
// Creates a pass which lowers for loops into while loops.
56-
std::unique_ptr<Pass> createForToWhileLoopPass();
57-
5855
//===----------------------------------------------------------------------===//
5956
// Registration
6057
//===----------------------------------------------------------------------===//

mlir/include/mlir/Dialect/SCF/Passes.td

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,39 +78,4 @@ def SCFForLoopRangeFolding
7878
let constructor = "mlir::createForLoopRangeFoldingPass()";
7979
}
8080

81-
def SCFForToWhileLoop
82-
: FunctionPass<"scf-for-to-while"> {
83-
let summary = "Convert SCF for loops to SCF while loops";
84-
let constructor = "mlir::createForToWhileLoopPass()";
85-
let description = [{
86-
This pass transforms SCF.ForOp operations to SCF.WhileOp. The For loop
87-
condition is placed in the 'before' region of the while operation, and the
88-
induction variable incrementation and loop body in the 'after' region.
89-
The loop carried values of the while op are the induction variable (IV) of
90-
the for-loop + any iter_args specified for the for-loop.
91-
Any 'yield' ops in the for-loop are rewritten to additionally yield the
92-
(incremented) induction variable.
93-
94-
```mlir
95-
# Before:
96-
scf.for %i = %c0 to %arg1 step %c1 {
97-
%0 = addi %arg2, %arg2 : i32
98-
memref.store %0, %arg0[%i] : memref<?xi32>
99-
}
100-
101-
# After:
102-
%0 = scf.while (%i = %c0) : (index) -> index {
103-
%1 = cmpi slt, %i, %arg1 : index
104-
scf.condition(%1) %i : index
105-
} do {
106-
^bb0(%i: index): // no predecessors
107-
%1 = addi %i, %c1 : index
108-
%2 = addi %arg2, %arg2 : i32
109-
memref.store %2, %arg0[%i] : memref<?xi32>
110-
scf.yield %1 : index
111-
}
112-
```
113-
}];
114-
}
115-
11681
#endif // MLIR_DIALECT_SCF_PASSES

mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
add_mlir_dialect_library(MLIRSCFTransforms
22
Bufferize.cpp
3-
ForToWhile.cpp
43
LoopCanonicalization.cpp
54
LoopPipelining.cpp
65
LoopRangeFolding.cpp

mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp

Lines changed: 0 additions & 110 deletions
This file was deleted.

mlir/test/Dialect/SCF/for-loop-to-while-loop.mlir

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)