[PATCH] D143726: [LoopInstSimplify] Simplify (X < A && X < B) into (X < MIN(A, B)) if MIN(A, B) is loop-invariant

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 01:38:19 PST 2023


mkazantsev planned changes to this revision.
mkazantsev added a comment.

In D143726#4128119 <https://reviews.llvm.org/D143726#4128119>, @nikic wrote:

> My high level question would be whether this should be part of LICM. Basically, what we're doing here is a reassociation transform to expose a loop invariant, which can then be hoisted. This recently also came up in other contexts, e.g. D143631 <https://reviews.llvm.org/D143631>.
>
> It looks like currently LoopInstSimplify is scheduled before LICM, so the operands might not have been hoisted yet. Having LICM rewrite expressions to enable hoisting would make sure that operands are hoisted first.

Making this in LICM also makes sense. We have a different pipeline, so in our case this happens after LICM (and other passes) as a cleanup.


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

https://reviews.llvm.org/D143726



More information about the llvm-commits mailing list