diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-11-30 17:06:02 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-11-30 17:06:02 +0000 |
commit | ccaf20cc53a3dc353f4786b1ebf4ebb3f81d4746 (patch) | |
tree | 526aace1ee6cd0126263e06eed2d23eae06d7d84 /lib/Analysis/InstructionSimplify.cpp | |
parent | 26c41c96df38631aa2bce1ff87acb31871111f83 (diff) | |
parent | 72a2c0622ab072030c9108badea50074d96bec6a (diff) |
Updating branches/google/testing to r168474
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/google/testing@169005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | lib/Analysis/InstructionSimplify.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index b3d62487fc..a76e5ad1b8 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -2065,8 +2065,25 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, if (A && C && (A == C || A == D || B == C || B == D) && NoLHSWrapProblem && NoRHSWrapProblem) { // Determine Y and Z in the form icmp (X+Y), (X+Z). - Value *Y = (A == C || A == D) ? B : A; - Value *Z = (C == A || C == B) ? D : C; + 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 { + assert(B == D); + // A + D == C + D -> A == C + Y = A; + Z = C; + } if (Value *V = SimplifyICmpInst(Pred, Y, Z, Q, MaxRecurse-1)) return V; } |