v6m cores only have a limited number of registers available. Unrolling can mean we spend more on stack spills and reloads than we save from the unrolling. This patch adds an extra heuristic to puts a limit on unroll count for loops with multiple live out values, as measured from the LCSSA phi nodes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | ||
---|---|---|
2209 | I would expect that most loops have a single exit, but the code above does allow (at most) 2 exit. From those I took the maximum of the number of liveouts as a rough heuristic, as I would expect the liveouts to be the same in many cases for multi-exit loops, and it probably doesn't want to count them twice. |
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | ||
---|---|---|
2209 | Ah yes, I now see: if (ExitingBlocks.size() > 2) return; above and also that the maximum is taken, thanks. | |
llvm/test/Transforms/LoopUnroll/ARM/v6munroll.ll | ||
53 | One nit/question about the test case then, would it be useful to have a test and loop with 2 exit blocks? |
Added a test with multiple exits (which was a bit hard to get past other profitability checks).
:-)