mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-03 12:18:00 +00:00
Make this easier to understand, as suggested by Chandler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user