OSDN Git Service

[InstCombine] canonicalize constant-minus-boolean to select-of-constants
authorSanjay Patel <spatel@rotateright.com>
Wed, 6 Dec 2017 21:22:57 +0000 (21:22 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 6 Dec 2017 21:22:57 +0000 (21:22 +0000)
commit2b68e112a31ad72dc10bee5fb430fe3ea8d63489
tree699c8941ae342c4430cb91d3594cf8983b138898
parent9044c81903ff76f20f65c4bf11cda073f17bde97
[InstCombine] canonicalize constant-minus-boolean to select-of-constants

This restores the half of:
https://reviews.llvm.org/rL75531
that was reverted at:
https://reviews.llvm.org/rL159230

For the x86 case mentioned there, we now produce:
leal 1(%rdi), %eax
subl %esi, %eax

We have target hooks to invert this in DAGCombiner (and x86 is enabled) with:
https://reviews.llvm.org/rL296977
https://reviews.llvm.org/rL311731

AArch64 and possibly other targets would probably benefit from enabling those hooks too.
See PR30327:
https://bugs.llvm.org/show_bug.cgi?id=30327#c2

Differential Revision: https://reviews.llvm.org/D40612

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319964 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/zext-bool-add-sub.ll