diff options
| author | Craig Topper <craig.topper@intel.com> | 2017-09-22 18:57:20 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2017-09-22 18:57:20 +0000 |
| commit | 2c9b7d7894f8f54e1afe4d5dc2247c0f6fdd62c1 (patch) | |
| tree | 456fde5e17be359fbaa428060181079d81d78bec /llvm/lib | |
| parent | 1c06f9a127bb92e150e31806541445f0a97ad533 (diff) | |
| download | bcm5719-llvm-2c9b7d7894f8f54e1afe4d5dc2247c0f6fdd62c1.tar.gz bcm5719-llvm-2c9b7d7894f8f54e1afe4d5dc2247c0f6fdd62c1.zip | |
[InstCombine] Make cases for ICMP_UGT/ICMP_ULT use similar formatting since they use similar code. NFC
llvm-svn: 314016
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 1f981720ad1..0a2d0e58b47 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -4226,20 +4226,17 @@ Instruction *InstCombiner::foldICmpUsingKnownBits(ICmpInst &I) { const APInt *CmpC; if (match(Op1, m_APInt(CmpC))) { // A <u C -> A == C-1 if min(A)+1 == C - if (Op1Max == Op0Min + 1) { - Constant *CMinus1 = ConstantInt::get(Op0->getType(), *CmpC - 1); - return new ICmpInst(ICmpInst::ICMP_EQ, Op0, CMinus1); - } + if (Op1Max == Op0Min + 1) + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, + ConstantInt::get(Op0->getType(), *CmpC - 1)); } break; } case ICmpInst::ICMP_UGT: { if (Op0Min.ugt(Op1Max)) // A >u B -> true if min(A) > max(B) return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType())); - if (Op0Max.ule(Op1Min)) // A >u B -> false if max(A) <= max(B) return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType())); - if (Op1Max == Op0Min) // A >u B -> A != B if min(A) == max(B) return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); |

