Description
Bugzilla Link | 50784 |
Version | unspecified |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @joker-eph,@bondhugula |
Extended Description
Hello all!
I’m trying to unroll the following loop using loopUnrollJamByFactor() with unroll factor value =7 (loop to be unrolled is denoted by (*))
#map2 = affine_map<(d0) -> (480, d0 * -480 + 2048)>
... ...
affine.for %arg4 = 0 to 5 {
... ...
affine.for %arg8 = 0 to min #map2(%arg4) { (*)
... ...
}
... ...
}
After loopUnrollJamByFactor() is done, in the output IR the following couple of loops is appeared instead of initial single loop (*):
#map2 = affine_map<(d0) -> (476, ((d0 * -480 + 2048) floordiv 7) * 7)>
#map13 = affine_map<(d0) -> (480, d0 * -480 + 2048)>
affine.for %arg4 = 0 to 5 {
... ...
affine.for %arg8 = 0 to min #map2(%arg4) step 7 {
... ...
}
affine.for %arg8 = max #map2(%arg4) to min #map13(%arg4) {
... ...
}
}
The first loop is correct and its upper bound is min #map2(%arg4) (it is divisible by 7), but why the lower bound of the second loop is max #map2(%arg4) while we have finished by value min #map2(%arg4) in the first loop?
It seems, the correct lower bound of the second loop should be the same as the upper bound of the 1-st one, i.e. should be min #map2(%arg4)…
Activity