[PATCH] D97747: [LoopUnrollRuntime] Add option to unroll loops with at most two exit/exiting blocks.
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 3 00:12:37 PST 2021
Meinersbur added a comment.
What is the motivation for the switch? Why wouldn't we want to unroll loops with 3 or more exits provided we can and the heuristic sais its profitable? Why is the cutoff at 3? Could we also pass the cutoff-point as an option?
================
Comment at: llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp:500-503
+ // Only enable unrolling of loops that have at most a single side exit other
+ // than the normal LatchExit.
+ if (OtherExits.size() > 1)
+ return false;
----------------
`OtherExits.size() > 1` will also make the `getTerminatingDeoptimizeCall` heuristic fail, so this is not a semantics change. However, I find the structure confusing, especially if we want to add more conditions that enable the optimization. Did you consider the following structure?
```
if (OtherExits.size() <= 1 && UnrollRuntimeAtMostTwoExits)
return true;
if (OtherExits.size() == 1 && OtherExits[0]->getTerminatingDeoptimizeCall())
return true;
// More conditions can be added here
return false;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97747/new/
https://reviews.llvm.org/D97747
More information about the llvm-commits
mailing list