[llvm] [InstCombine] Fold `select Cond, not X, X` into `Cond ^ X` (PR #93591)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 11:51:20 PDT 2024


dtcxzyw wrote:

Missed optimization from cvc5: https://alive2.llvm.org/ce/z/s3a6rd
```
define i1 @src (i1 %cmp23, i1 %pol) {
   %lnot = xor i1 %pol, true
   call void @use(i1 %lnot)
   %lnot.pol = select i1 %cmp23, i1 %lnot, i1 %pol
   ret i1 %lnot.pol
}

define i1 @tgt(i1 %cmp23, i1 %pol) {
   %lnot = xor i1 %pol, true
   call void @use(i1 %lnot)
   %lnot.pol = xor i1 %cmp23, %pol
   ret i1 %lnot.pol
}

declare void @use(i1)
```


https://github.com/llvm/llvm-project/pull/93591


More information about the llvm-commits mailing list