[PATCH] D35182: [InstCombine] remove one-use restriction for not (cmp P, A, B) --> cmp P', A, B

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 09:11:37 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

We can always move the 'not' op of a compare into the predicate of the compare itself to eliminate the not (xor).

The test case (poo) that looks worse was discussed in https://reviews.llvm.org/D33172 / PR32791 ( https://bugs.llvm.org/show_bug.cgi?id=32791 ). The common value is easy for CSE to detect, so there should be no actual regressions in that case.

https://reviews.llvm.org/D35044 reminded me that I had a draft patch for this ready to go once PR32791 was resolved. That change will make this cleaner, but it doesn't affect the functionality.

This patch will help clear the way for the remaining fixes needed to resolve:
https://bugs.llvm.org/show_bug.cgi?id=32791 (making 'not' ops rather than random 'xor' canonical in IR).


https://reviews.llvm.org/D35182

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/logical-select.ll
  test/Transforms/InstCombine/select-cmp-br.ll
  test/Transforms/LoopVectorize/if-conversion-nest.ll
  test/Transforms/LoopVectorize/if-conversion.ll
  test/Transforms/SimplifyCFG/merge-cond-stores.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35182.105778.patch
Type: text/x-patch
Size: 8204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170709/498d21e7/attachment.bin>


More information about the llvm-commits mailing list