HCFG builder doesn't correctly handle cases when non-outermost loop is
requested to be vectorized
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp | ||
---|---|---|
122 | I am not sure this check is sufficient, e.g. if BB is the header of an another loop with the same nesting level as TheLoop. Not sure if that's possible at the moment as a preheader might be required in all cases, still would be good to add a test case. IIUC the condition we need to check is that CurrentLoop is either TheLoop or a sub loop of it; should be sufficient to check if TheLoop->contains(CurrentLoop). I think this only checks one level, but all loops we currently support should be an inner loop with its outer loop. Could also have an assertion to ensure that (e.g. walk up through CurrentLoop's parents and check that not more than 1 step is needed to reach TheLoop. | |
llvm/test/Transforms/LoopVectorize/outer_loop_test3.ll | ||
3 | -pass-remarks=loop-vectorize not needed? | |
18 | would be good to have a more descriptive name & a comment with a brief description of what this tests. Test name could also include more info. | |
97 | should not be needed | |
102 | Could you rename the labels & value names to be more descriptive (and shorter)? e.g. something like loop.1.header, loop.1.latch, iv.1 and so on. | |
107 | should not be needed. |
Reverse ping. This patch should unblock adding first end-to-end testing for outer loop vectorization to the llvm-test-suite (https://github.com/llvm/llvm-test-suite/pull/20).
The VPlan construction logic changed quite since the patch was posted and I think the patch would need a rebase.
Thanks for reminder. I drowned in other work and forgot about it.
Will move it to github and address your comments there.
I am not sure this check is sufficient, e.g. if BB is the header of an another loop with the same nesting level as TheLoop. Not sure if that's possible at the moment as a preheader might be required in all cases, still would be good to add a test case.
IIUC the condition we need to check is that CurrentLoop is either TheLoop or a sub loop of it; should be sufficient to check if TheLoop->contains(CurrentLoop). I think this only checks one level, but all loops we currently support should be an inner loop with its outer loop. Could also have an assertion to ensure that (e.g. walk up through CurrentLoop's parents and check that not more than 1 step is needed to reach TheLoop.