[llvm] r306781 - Reduce indenting and clean up comparisons around sign bit.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 18:57:48 PDT 2017


Author: echristo
Date: Thu Jun 29 18:57:48 2017
New Revision: 306781

URL: http://llvm.org/viewvc/llvm-project?rev=306781&view=rev
Log:
Reduce indenting and clean up comparisons around sign bit.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=306781&r1=306780&r2=306781&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Jun 29 18:57:48 2017
@@ -1448,12 +1448,13 @@ Instruction *InstCombiner::foldICmpWithC
     // 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;




More information about the llvm-commits mailing list