diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 8cb4a59cba9..e223a049f0b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2356,8 +2356,20 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {          // Try not to increase register pressure.          BO0->hasOneUse() && BO1->hasOneUse()) {        // 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) { +        Y = B; +        Z = D; +      } else if (A == D) { +        Y = B; +        Z = C; +      } else if (B == C) { +        Y = A; +        Z = D; +      } else if (B == D) { +        Y = A; +        Z = C; +      }        return new ICmpInst(Pred, Y, Z);      } | 

