mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-04 10:59:04 +00:00
InstSimplify: Try to bring back the rest of r223583
This reverts r223624 with a small tweak, hopefully this will make stage3 equivalent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223679 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
28eb431b8c
commit
fca9c7b21c
@ -1448,8 +1448,8 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
|
|||||||
Value *X, *Y;
|
Value *X, *Y;
|
||||||
|
|
||||||
ICmpInst::Predicate EqPred;
|
ICmpInst::Predicate EqPred;
|
||||||
if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) &&
|
if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) ||
|
||||||
ICmpInst::isEquality(EqPred))
|
!ICmpInst::isEquality(EqPred))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
ICmpInst::Predicate UnsignedPred;
|
ICmpInst::Predicate UnsignedPred;
|
||||||
@ -1476,6 +1476,11 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
|
|||||||
return UnsignedICmp;
|
return UnsignedICmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X < Y && Y == 0 --> false
|
||||||
|
if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_EQ &&
|
||||||
|
IsAnd)
|
||||||
|
return getFalse(UnsignedICmp->getType());
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +166,15 @@ define i1 @and_icmp1(i32 %x, i32 %y) {
|
|||||||
; CHECK: %[[cmp:.*]] = icmp ult i32 %x, %y
|
; CHECK: %[[cmp:.*]] = icmp ult i32 %x, %y
|
||||||
; CHECK: ret i1 %[[cmp]]
|
; CHECK: ret i1 %[[cmp]]
|
||||||
|
|
||||||
|
define i1 @and_icmp2(i32 %x, i32 %y) {
|
||||||
|
%1 = icmp ult i32 %x, %y
|
||||||
|
%2 = icmp eq i32 %y, 0
|
||||||
|
%3 = and i1 %1, %2
|
||||||
|
ret i1 %3
|
||||||
|
}
|
||||||
|
; CHECK-LABEL: @and_icmp2(
|
||||||
|
; CHECK: ret i1 false
|
||||||
|
|
||||||
define i1 @or_icmp1(i32 %x, i32 %y) {
|
define i1 @or_icmp1(i32 %x, i32 %y) {
|
||||||
%1 = icmp ult i32 %x, %y
|
%1 = icmp ult i32 %x, %y
|
||||||
%2 = icmp ne i32 %y, 0
|
%2 = icmp ne i32 %y, 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user