1
0
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:
Duncan Sands 2012-11-16 20:53:08 +00:00
parent 4fbbfcc6a6
commit e52f0de8bb
2 changed files with 12 additions and 2 deletions

View File

@ -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).
Value *Y, *Z;
if (A == C) {
// C + B == C + D -> B == D
Y = B;
Z = D;
} else if (A == D) {
// D + B == C + D -> B == C
Y = B;
Z = C;
} else if (B == C) {
// A + C == C + D -> A == D
Y = A;
Z = D;
} else if (B == D) {
} else {
assert(B == D);
// A + D == C + D -> A == C
Y = A;
Z = C;
}

View File

@ -2358,15 +2358,20 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
// Determine Y and Z in the form icmp (X+Y), (X+Z).
Value *Y, *Z;
if (A == C) {
// C + B == C + D -> B == D
Y = B;
Z = D;
} else if (A == D) {
// D + B == C + D -> B == C
Y = B;
Z = C;
} else if (B == C) {
// A + C == C + D -> A == D
Y = A;
Z = D;
} else if (B == D) {
} else {
assert(B == D);
// A + D == C + D -> A == C
Y = A;
Z = C;
}