[PATCH] D46595: [InstCombine] Apply SimplifyUsingDistributiveLaws to associative/commutative cases.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 11:59:58 PDT 2018


yamauchi created this revision.
yamauchi added a reviewer: davidxl.

Apply SimplifyUsingDistributiveLaws 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/D46595

Files:
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/bit-check-combine.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46595.145752.patch
Type: text/x-patch
Size: 55004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180508/83c9ffb5/attachment.bin>


More information about the llvm-commits mailing list