[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 12 11:10:09 PDT 2016


spatel created this revision.
spatel added reviewers: eli.friedman, majnemer, hfinkel.
spatel added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

We discussed this a bit in D21899.

By creating the official 'not' IR construct, we can:
1. Remove DeMorgan-matching code that was added specifically to work-around the missing transform in http://reviews.llvm.org/rL248634.
2. Make the DeMorgan transform for vectors too.
3. Fix PR28476: https://llvm.org/bugs/show_bug.cgi?id=28476

I don't see any other transforms that were relying on the previous transform, so I think it's safe to replace it.

The test changes outside of the demorgan-zext.ll file look neutral to me; those just show that the xor gets pulled ahead of the zext. But we could make the argument that those transforms actually are improvements too because doing logic ops in a smaller type should always provide >= optimization opportunity to later passes.

http://reviews.llvm.org/D22271

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  test/Transforms/InstCombine/apint-select.ll
  test/Transforms/InstCombine/demorgan-zext.ll
  test/Transforms/InstCombine/select.ll
  test/Transforms/InstCombine/zext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22271.63694.patch
Type: text/x-patch
Size: 8820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160712/23d4841f/attachment.bin>


More information about the llvm-commits mailing list