mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-07 12:30:57 +00:00
In which I discover that zero+zero is zero, d'oh!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124188 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
afde5188f2
commit
227fba11ca
@ -740,10 +740,10 @@ bool llvm::isKnownNonZero(Value *V, const TargetData *TD, unsigned Depth) {
|
||||
ComputeSignBit(Y, YKnownNonNegative, YKnownNegative, TD, Depth);
|
||||
|
||||
// If X and Y are both non-negative (as signed values) then their sum is not
|
||||
// zero.
|
||||
// zero unless both X and Y are zero.
|
||||
if (XKnownNonNegative && YKnownNonNegative)
|
||||
return false;
|
||||
// return true;
|
||||
if (isKnownNonZero(X, TD, Depth) || isKnownNonZero(Y, TD, Depth))
|
||||
return true;
|
||||
|
||||
// If X and Y are both negative (as signed values) then their sum is not
|
||||
// zero unless both X and Y equal INT_MIN.
|
||||
|
@ -61,11 +61,14 @@ define i1 @sext3() {
|
||||
}
|
||||
|
||||
define i1 @add(i32 %x, i32 %y) {
|
||||
; CHECK: @add
|
||||
%l = lshr i32 %x, 1
|
||||
%r = lshr i32 %y, 1
|
||||
%q = lshr i32 %y, 1
|
||||
%r = or i32 %q, 1
|
||||
%s = add i32 %l, %r
|
||||
%c = icmp eq i32 %s, 0
|
||||
ret i1 %c
|
||||
; CHECK: ret i1 false
|
||||
}
|
||||
|
||||
define i1 @add2(i8 %x, i8 %y) {
|
||||
@ -78,6 +81,16 @@ define i1 @add2(i8 %x, i8 %y) {
|
||||
; CHECK: ret i1 false
|
||||
}
|
||||
|
||||
define i1 @add3(i8 %x, i8 %y) {
|
||||
; CHECK: @add3
|
||||
%l = zext i8 %x to i32
|
||||
%r = zext i8 %y to i32
|
||||
%s = add i32 %l, %r
|
||||
%c = icmp eq i32 %s, 0
|
||||
ret i1 %c
|
||||
; CHECK: ret i1 %c
|
||||
}
|
||||
|
||||
define i1 @addpowtwo(i32 %x, i32 %y) {
|
||||
; CHECK: @addpowtwo
|
||||
%l = lshr i32 %x, 1
|
||||
|
Loading…
Reference in New Issue
Block a user