[PATCH] D136233: [SimpleLoopUnswitch] Inject loop-invariant conditions and unswitch them when it's profitable

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 04:23:24 PST 2023


mkazantsev added a comment.

In D136233#4078066 <https://reviews.llvm.org/D136233#4078066>, @apilipenko wrote:

> It occurred to me that this is an optimization only if the injected condition is likely. Then we would likely take the version with the loop with the removed loop variant condition. Otherwise, we spend code size and add an extra check before executing the loop with both loop variant conditions. I suggest using the profiling info on the branch to be eliminated to decide whether this is profitable.

We only do it for loop-exiting branch. So in the end, when CFG is simplified, there will no be loop duplication. Why do you think it's a problem at all?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136233/new/

https://reviews.llvm.org/D136233



More information about the llvm-commits mailing list