diff options
author | Eric Christopher <echristo@gmail.com> | 2017-06-30 01:57:48 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2017-06-30 01:57:48 +0000 |
commit | a95aac375128523df97fd2ba631b4208d2c6de0c (patch) | |
tree | 58d3eb6459e321b385732d5a1ff5ca4583a905bc /llvm/lib | |
parent | 5dcdc7a3d36e0a32d5ab6487c8aaccf2678313a5 (diff) | |
download | bcm5719-llvm-a95aac375128523df97fd2ba631b4208d2c6de0c.tar.gz bcm5719-llvm-a95aac375128523df97fd2ba631b4208d2c6de0c.zip |
Reduce indenting and clean up comparisons around sign bit.
llvm-svn: 306781
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index aec36f5483a..58b8b2f5262 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1448,12 +1448,13 @@ Instruction *InstCombiner::foldICmpWithConstant(ICmpInst &Cmp) { // of a test and branch. So we avoid canonicalizing in such situations // because test and branch instruction has better branch displacement // than compare and branch instruction. - if (!(IsSignBit && hasBranchUse(Cmp)) && !Cmp.isEquality()) { - if (auto *AI = Intersection.getSingleElement()) - return new ICmpInst(ICmpInst::ICMP_EQ, X, Builder->getInt(*AI)); - if (auto *AD = Difference.getSingleElement()) - return new ICmpInst(ICmpInst::ICMP_NE, X, Builder->getInt(*AD)); - } + if (Cmp.isEquality() || (IsSignBit && hasBranchUse(Cmp))) + return nullptr; + + if (auto *AI = Intersection.getSingleElement()) + return new ICmpInst(ICmpInst::ICMP_EQ, X, Builder->getInt(*AI)); + if (auto *AD = Difference.getSingleElement()) + return new ICmpInst(ICmpInst::ICMP_NE, X, Builder->getInt(*AD)); } return nullptr; |