The unroll pass was disabled by clang in /Os. Those new test cases shows that the pass will behave correctly even if it is not fully disabled. This patch is related to http://reviews.llvm.org/D19827, which would re-enable the pass in /Os.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
-Please refactor the optsize tests into a single file (e.g., unroll-optsize.ll). If you factored all the test into a single file that would be even better. We want to minimize the number of times opt is invoked.
-Please add a test case for minsize. In this case we don't want to unroll the loop, if I'm not mistaken.
How are we handling -O1? The clang patch D19827 will have a functional change at this optimization level, if I'm not mistaken.
test/Transforms/LoopUnroll/unroll-optnone.ll | ||
---|---|---|
19 ↗ | (On Diff #55993) | Please add a CHECK-LABEL directive. I.e., CHECK-LABEL: @unroll_optnone |
test/Transforms/LoopUnroll/unroll-optsize1.ll | ||
19 ↗ | (On Diff #55993) | Please add a CHECK-LABEL directive. |
test/Transforms/LoopUnroll/unroll-optsize2.ll | ||
18 ↗ | (On Diff #55993) | Please add a CHECK-LABEL directive. |
- I am not sure it is possible to merge the optsize tests in one call to opt, since one of them use the -unroll-count parameter and not the other. Do you see another way to do that?
- According to a previous commit fixing the behavior of minsize, I think it should behave the same as with optsize. See http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160111/323952.html.
You can have multiple RUN lines in a file. To differentiate the runs you can use the FileCheck --check-prefix command.
For example, look at the top of the loop-remarks.ll test in llvm/test/Transforms/LoopUnroll.
Something like:
; RUN: opt < %s -S -loop-unroll | FileCheck %s ; RUN: opt < %s -S -loop-unroll -unroll-count=4 | FileCheck -check-prefix=UNROLLCOUNT4 %s
By default, FileCheck assumes the prefix is CHECK. Therefore, unroll-optnone.ll and unroll-optsize2.ll can just use the CHECK: directive, while all the CHECK directives in the unroll-optsize1.ll file will be UNROLLCOUNT4:
Hopefully, that all makes sense.
- According to a previous commit fixing the behavior of minsize, I think it should behave the same as with optsize. See http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160111/323952.html.
In that case, please add a test case with minsize that shows the expected behavior.
I'm still interested to know how loop unroll behaves at -O1.
Ok, thanks! I will modify the test cases and merge them in one file.
For /O1, I think you are right about the clang patch having a functional change. I don't see anything preventing the unrolling to execute in /O1.
- Merged test cases into one file.
- Added a case for minsize.
- Modified the test that shows the behavior of optsize when no unroll factor is specified.