diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-06-25 14:15:28 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-06-25 14:15:28 +0000 |
| commit | 2f3ead7adc103ac855ef739f9b6782df138db233 (patch) | |
| tree | 92bdcceac3604c3853742fa4a19ea376aa236519 /llvm/test/Transforms/LoopUnroll | |
| parent | 72f991cdedeeabc72d00b3d79ecc55a3a025dd81 (diff) | |
| download | bcm5719-llvm-2f3ead7adc103ac855ef739f9b6782df138db233.tar.gz bcm5719-llvm-2f3ead7adc103ac855ef739f9b6782df138db233.zip | |
[InstCombine] add (sext i1 X), 1 --> zext (not X)
http://rise4fun.com/Alive/i8Q
A narrow bitwise logic op is obviously better than math for value tracking,
and zext is better than sext. Typically, the 'not' will be folded into an
icmp predicate.
The IR difference would even survive through codegen for x86, so we would see
worse code:
https://godbolt.org/g/C14HMF
one_or_zero(int, int): # @one_or_zero(int, int)
xorl %eax, %eax
cmpl %esi, %edi
setle %al
retq
one_or_zero_alt(int, int): # @one_or_zero_alt(int, int)
xorl %ecx, %ecx
cmpl %esi, %edi
setg %cl
movl $1, %eax
subl %ecx, %eax
retq
llvm-svn: 306243
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll')
0 files changed, 0 insertions, 0 deletions

