[Mlir-commits] [mlir] [mlir][scf] Uplift `scf.while` to `scf.for` (PR #76108)
Ivan Butygin
llvmlistbot at llvm.org
Thu Dec 21 05:39:25 PST 2023
================
@@ -154,4 +154,20 @@ def SCFForToWhileLoop : Pass<"scf-for-to-while"> {
}];
}
+def SCFUpliftWhileToFor : Pass<"scf-uplift-while-to-for"> {
+ let summary = "Uplift scf.while ops to scf.for";
+ let description = [{
+ This pass tries to uplift `scf.while` ops to `scf.for` if they have a
+ compatible form. `scf.while` are left unchanged if uplifting is not
+ possible.
+ }];
+
+ let options = [
+ Option<"indexBitWidth", "index-bitwidth", "unsigned",
+ /*default=*/"64",
+ "Bitwidth of index type.">,
+ ];
----------------
Hardcode84 wrote:
Non-index type support in `scf.for` was a late addition, and not all parts in pipeline support it (e.g. `scf.parallel` only support index), and we never really needed non-index `scf.for`s internally. Also, using index type can be actually beneficially as it reduces amount of `index_cast`s needed when working with tensors/memrefs.
Anyway, I'll change pattern to support any integer type and will probably do maximizing index type as separate transform.
https://github.com/llvm/llvm-project/pull/76108
More information about the Mlir-commits
mailing list