[PATCH] D141660: [InstCombine] Fold pattern xor(and, or) to select

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 19:49:50 PST 2023


bcl5980 added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/xor-and-or.ll:4
 
 define i1 @xor_logic_and_logic_or1(i1 %c, i1 %x, i1 %y) {
 ; CHECK-LABEL: @xor_logic_and_logic_or1(
----------------
spatel wrote:
> How does this example already get optimized? Can we remove the code that handled it?
This pattern is optimized in SimplifySelectsFeedingBinaryOp.
```
(A ? B : C) op (A ? E : F) -> A ? (B op E) : (C op F)
```
I don't think we can remove the code as it can handle not only i1 types.


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

https://reviews.llvm.org/D141660



More information about the llvm-commits mailing list