[all-commits] [llvm/llvm-project] 96901f: [mlir][SCF] Do not peel already peeled loops (#71900)
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed Nov 15 18:48:11 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 96901f1b02602589d2adc8de48671529f4090dde
https://github.com/llvm/llvm-project/commit/96901f1b02602589d2adc8de48671529f4090dde
Author: Matthias Springer <me at m-sp.org>
Date: 2023-11-16 (Thu, 16 Nov 2023)
Changed paths:
M mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
M mlir/lib/IR/AffineExpr.cpp
M mlir/test/Dialect/Affine/canonicalize.mlir
M mlir/test/Dialect/SCF/transform-ops-invalid.mlir
Log Message:
-----------
[mlir][SCF] Do not peel already peeled loops (#71900)
Loop peeling is not beneficial if the step size already divides "ub -
lb". There are currently some simple checks to prevent peeling in such
cases when lb, ub, step are constants. This commit adds support for IR
that is the result of loop peeling in the general case; i.e., lb, ub,
step do not necessarily have to be constants.
This change adds a new affine_map simplification rule for semi-affine
maps that appear during loop peeling and are guaranteed to evaluate to a
constant zero. Affine maps such as:
```
(1) affine_map<()[ub, step] -> ((ub - ub mod step) mod step)
(2) affine_map<()[ub, lb, step] -> ((ub - (ub - lb) mod step - lb) mod step)
(3) ^ may contain additional summands
```
Other affine maps with modulo expressions are not supported by the new
simplification rule.
This fixes #71469.
More information about the All-commits
mailing list