mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[CGP] match a special-case of unsigned subtract overflow
This is the 'sub0' (negate) pattern from PR31754: https://bugs.llvm.org/show_bug.cgi?id=31754 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1228,6 +1228,11 @@ static bool combineToUSubWithOverflow(CmpInst *Cmp, const TargetLowering &TLI,
|
||||
B = ConstantInt::get(B->getType(), 1);
|
||||
Pred = ICmpInst::ICMP_ULT;
|
||||
}
|
||||
// Convert special-case: (A != 0) is the same as (0 u< A).
|
||||
if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt())) {
|
||||
std::swap(A, B);
|
||||
Pred = ICmpInst::ICMP_ULT;
|
||||
}
|
||||
if (Pred != ICmpInst::ICMP_ULT)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user