[PATCH] D41953: [LoopUnroll] Unroll and Jam
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 4 08:24:35 PDT 2018
dmgreen added a comment.
I was being a bit vague, what I meant was that if we have a pass structure like this, as we have now but with added unroll and jam:
Loop Pass Manager
Induction Variable Simplification
Recognize loop idioms
Delete dead loops
Unroll and Jam
Unroll loops
With a nest with inner and outer loops, the passes will be done in this order:
IndVar simplify inner loop
Recognise inner loop
Delete Dead inner loop
UnJ inner loop
Unroll inner loop
IndVar simplify outer loop
Recognise outer loop
Delete Dead outer loop
UnJ outer loop
Unroll outer loop
So when Unj gets to the outer loop, the inner loop may have been unrolled. So the unroll for the inner loop would have to know whether the loop nest was profitable to unroll and jam and -not- unroll in that case. To get the UnJ of the outer loop to happen before the unroll of the inner loop, two loop pass managers are needed (in this case one just for the Unroll Loops). This can affect code generation for existing cases, which was something I was hoping to avoid. I saw some cases of infinite loops being generated differently when I had it like that for testing.
What I am hoping is that we won't have to add UnJ here in the pass pipeline, we can add it later at the other place that we do unrolling. This should allow us to more easily have two loop pass managers, simplifying things a lot :)
Repository:
rL LLVM
https://reviews.llvm.org/D41953
More information about the llvm-commits
mailing list