Sanjay Patel
e272be7c9a
[ValueTracking] return zero when there's conflict in known bits of a shift (PR34838)
...
Poison allows us to return a better result than undef.
llvm-svn: 315595
2017-10-12 17:31:46 +00:00
Sanjay Patel
865e6c852b
[InstSimplify] add tests to show we can do better at folding poison; NFC
...
llvm-svn: 315152
2017-10-07 15:39:06 +00:00
Sanjay Patel
562272536a
[InstSimplify] try to eliminate icmp Pred (add nsw X, C1), C2
...
I was surprised to see that we're missing icmp folds based on 'add nsw' in InstCombine,
but we should handle the InstSimplify cases first because that could make the InstCombine
code simpler.
Here are Alive-based proofs for the logic:
Name: add_neg_constant
Pre: C1 < 0 && (C2 > ((1<<(width(C1)-1)) + C1))
%a = add nsw i7 %x, C1
%b = icmp sgt %a, C2
=>
%b = false
Name: add_pos_constant
Pre: C1 > 0 && (C2 < ((1<<(width(C1)-1)) + C1 - 1))
%a = add nsw i6 %x, C1
%b = icmp slt %a, C2
=>
%b = false
Name: nuw
Pre: C1 u>= C2
%a = add nuw i11 %x, C1
%b = icmp ult %a, C2
=>
%b = false
Differential Revision: https://reviews.llvm.org/D29053
llvm-svn: 292952
2017-01-24 17:03:24 +00:00
Sanjay Patel
ce9d6faed6
[InstSimplify] add tests to show missing folds from 'icmp (add nsw)'; NFC
...
llvm-svn: 292841
2017-01-23 22:42:55 +00:00
Sanjay Patel
6946e2ade3
[InstSimplify] allow icmp with constant folds for splat vectors, part 2
...
Completes the m_APInt changes for simplifyICmpWithConstant().
Other commits in this series:
https://reviews.llvm.org/rL279492
https://reviews.llvm.org/rL279530
https://reviews.llvm.org/rL279534
https://reviews.llvm.org/rL279538
llvm-svn: 279543
2016-08-23 18:00:51 +00:00
Sanjay Patel
200e3cbfb0
[InstSimplify] allow icmp with constant folds for splat vectors, part 1
...
llvm-svn: 279538
2016-08-23 17:30:56 +00:00
Sanjay Patel
ada2bb3d5d
[InstSimplify] add tests to show missing vector icmp folds
...
llvm-svn: 279534
2016-08-23 17:13:38 +00:00
Sanjay Patel
5c269d0b7a
[InstSimplify] move icmp with constant tests to another file; NFC
...
...because like the corresponding code, this is just too big to keep adding to.
And the next step is to add a vector version of each of these tests to show
missed folds.
Also, auto-generate CHECK lines and add comments for the tests that correspond to
the source code.
llvm-svn: 279530
2016-08-23 16:46:53 +00:00