[PATCH] D46336: [InstCombine] Apply binary operator simplifications to associative/commutative cases.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 15:54:44 PDT 2018


yamauchi created this revision.
yamauchi added a reviewer: davidxl.
Herald added a reviewer: javed.absar.

Apply the instruction combiner binary operator simplifications to the
associative/commutative cases. For example, if we have "(A op B) op C", we try
to transform it to "A op (B op C)" and try to simplify the "(B op C)" part (even
when "(B op C)" doesn't fold to a constant).

A motivation example is a bit-check combining simplification like

((A & 1) == 0) && ((A & 2) == 0) && ((A & 4) == 0) &&
((B & 1) == 0) && ((B & 2) == 0) && ((B & 4) == 0)

-->

((A & 7) == 0) && ((B & 7) == 0)

which didn't fully happen previously.


Repository:
  rL LLVM

https://reviews.llvm.org/D46336

Files:
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Bitcode/value-with-long-name.ll
  test/Transforms/InstCombine/add.ll
  test/Transforms/InstCombine/and-xor-or.ll
  test/Transforms/InstCombine/bit-check-combine.ll
  test/Transforms/InstCombine/demand_shrink_nsw.ll
  test/Transforms/InstCombine/or.ll
  test/Transforms/LoopVectorize/AArch64/reduction-small-size.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46336.144806.patch
Type: text/x-patch
Size: 87830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/afdc44ee/attachment-0001.bin>


More information about the llvm-commits mailing list