[PATCH] D153963: [InstCombine] Fold add of select and zext/sext of select condition
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 08:08:22 PDT 2023
goldstein.w.n added a comment.
Can you add alive2 link for this? I think it also works a lot more binops than just `add`. If so, can you split to a helper so it can be used elsewhere.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1488
+ // select A, T_C + 1, F_C (for Z = zext A)
+ // select A, T_C - 1, F_C (for Z = sext A)
+ // Take into account the negation as well.
----------------
I had a lot of trouble following this comment can you make say:
```
(select cond, (add X, 1), X)
-> (add X, (zext cond))
```
then some format for sext.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153963/new/
https://reviews.llvm.org/D153963
More information about the llvm-commits
mailing list