[PATCH] D148414: [InstCombine] Expand `foldSelectICmpAndOr` -> `foldSelectICmpAndBinOp` to work for any binop

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 23 13:35:49 PDT 2023


goldstein.w.n added a comment.

In D148414#4290852 <https://reviews.llvm.org/D148414#4290852>, @nikic wrote:

> In D148414#4290790 <https://reviews.llvm.org/D148414#4290790>, @goldstein.w.n wrote:
>
>> 2. Update `foldSelectIntoOp` to do constants iff `isPow2(abs(TC - FC))` and `Cond` is  either `(ICmp eq Pow2OrZero, C_Pow2)` or a SignTest
>
> Ideally we would just remove the limitation entirely -- at the IR level, we would certainly prefer having a select on constants. However, this would likely need a backend undo transform, because that saves materializing the zero constant and likely allows folding the other constant into an immediate operand.

Yeah that makes sense.

I'll get started on a series to do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148414



More information about the llvm-commits mailing list