[PATCH] D22271: [InstCombine] reverse canonicalization of xor(zext i1 A), 1 <---> zext(not i1 A, true) (PR28476)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 16:19:50 PDT 2016


spatel updated this revision to Diff 64585.
spatel added a comment.

Patch updated:
The deletions are identical to the earlier rev: (a) the specialized DeMorgan matcher (b) the canonicalization of zext before xor i1.

Instead of limiting this to only xor i1+zext, however, move any bitwise logic with a constant to the source type of the zext if the constant fits. I don't think there's any reason to limit the transform to i1 types. The vector case for doing this kind of transform came up in:
https://llvm.org/bugs/show_bug.cgi?id=28160

https://reviews.llvm.org/D22421 transforms the patterns that Eli noted.
https://reviews.llvm.org/D22477 handled the only existing test that I found that would have regressed from this change.


https://reviews.llvm.org/D22271

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  test/Transforms/InstCombine/apint-select.ll
  test/Transforms/InstCombine/assoc-cast-assoc.ll
  test/Transforms/InstCombine/cast.ll
  test/Transforms/InstCombine/demorgan-zext.ll
  test/Transforms/InstCombine/select.ll
  test/Transforms/InstCombine/zeroext-and-reduce.ll
  test/Transforms/InstCombine/zext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22271.64585.patch
Type: text/x-patch
Size: 12763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/9db84cf6/attachment.bin>


More information about the llvm-commits mailing list