[all-commits] [llvm/llvm-project] b92412: [InstCombine] Fold `(a & ~b) & ~c` to `a & ~(b | c)`

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Wed Oct 20 13:06:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b92412fb286be26d6f033b9ec283b1b18cb57869
      https://github.com/llvm/llvm-project/commit/b92412fb286be26d6f033b9ec283b1b18cb57869
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2021-10-20 (Wed, 20 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/and-xor-or.ll

  Log Message:
  -----------
  [InstCombine] Fold `(a & ~b) & ~c` to `a & ~(b | c)`

  %not1 = xor i32 %b, -1
  %not2 = xor i32 %c, -1
  %and1 = and i32 %a, %not1
  %and2 = and i32 %and1, %not2
=>
  %i1 = or i32 %b, %c
  %i2 = xor i32 %1, -1
  %and2 = and i32 %i2, %a

Differential Revision: https://reviews.llvm.org/D112108




More information about the All-commits mailing list