[PATCH] D122152: [InstCombine] Fold two select patterns into and-or

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 06:28:34 PDT 2022


spatel added a comment.

Does this fix https://github.com/llvm/llvm-project/issues/54313 ?

We need to account for the case where the 'not' is operand 1 of the other bitwise logic op. This won't happen in minimal tests because of commutation canonicalization rules, but you can add tests like this to exercise that path:

  declare i1 @gen_i1()
  
  define i1 @and_or1(i1 %a, i1 %b) {
    %c = call i1 @gen_i1()
    %nota = xor i1 %a, true
    %cond = or i1 %c, %nota
    %r = select i1 %cond, i1 %a, i1 %b
    ret i1 %r
  }


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

https://reviews.llvm.org/D122152



More information about the llvm-commits mailing list