mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Make this easier to understand, as suggested by Chandler.
llvm-svn: 168196
This commit is contained in:
parent
4fbbfcc6a6
commit
e52f0de8bb
@ -2067,15 +2067,20 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
|
|||||||
// Determine Y and Z in the form icmp (X+Y), (X+Z).
|
// Determine Y and Z in the form icmp (X+Y), (X+Z).
|
||||||
Value *Y, *Z;
|
Value *Y, *Z;
|
||||||
if (A == C) {
|
if (A == C) {
|
||||||
|
// C + B == C + D -> B == D
|
||||||
Y = B;
|
Y = B;
|
||||||
Z = D;
|
Z = D;
|
||||||
} else if (A == D) {
|
} else if (A == D) {
|
||||||
|
// D + B == C + D -> B == C
|
||||||
Y = B;
|
Y = B;
|
||||||
Z = C;
|
Z = C;
|
||||||
} else if (B == C) {
|
} else if (B == C) {
|
||||||
|
// A + C == C + D -> A == D
|
||||||
Y = A;
|
Y = A;
|
||||||
Z = D;
|
Z = D;
|
||||||
} else if (B == D) {
|
} else {
|
||||||
|
assert(B == D);
|
||||||
|
// A + D == C + D -> A == C
|
||||||
Y = A;
|
Y = A;
|
||||||
Z = C;
|
Z = C;
|
||||||
}
|
}
|
||||||
|
@ -2358,15 +2358,20 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
|||||||
// Determine Y and Z in the form icmp (X+Y), (X+Z).
|
// Determine Y and Z in the form icmp (X+Y), (X+Z).
|
||||||
Value *Y, *Z;
|
Value *Y, *Z;
|
||||||
if (A == C) {
|
if (A == C) {
|
||||||
|
// C + B == C + D -> B == D
|
||||||
Y = B;
|
Y = B;
|
||||||
Z = D;
|
Z = D;
|
||||||
} else if (A == D) {
|
} else if (A == D) {
|
||||||
|
// D + B == C + D -> B == C
|
||||||
Y = B;
|
Y = B;
|
||||||
Z = C;
|
Z = C;
|
||||||
} else if (B == C) {
|
} else if (B == C) {
|
||||||
|
// A + C == C + D -> A == D
|
||||||
Y = A;
|
Y = A;
|
||||||
Z = D;
|
Z = D;
|
||||||
} else if (B == D) {
|
} else {
|
||||||
|
assert(B == D);
|
||||||
|
// A + D == C + D -> A == C
|
||||||
Y = A;
|
Y = A;
|
||||||
Z = C;
|
Z = C;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user