[llvm] r185096 - Remove unnecessary conditional checks.

Chad Rosier mcrosier at apple.com
Thu Jun 27 13:19:14 PDT 2013


Author: mcrosier
Date: Thu Jun 27 15:19:13 2013
New Revision: 185096

URL: http://llvm.org/viewvc/llvm-project?rev=185096&view=rev
Log:
Remove unnecessary conditional checks.

Modified:
    llvm/trunk/include/llvm/TableGen/Record.h

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=185096&r1=185095&r2=185096&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Thu Jun 27 15:19:13 2013
@@ -1782,30 +1782,28 @@ struct LessRecordRegister {
     for (size_t I = 0, E = LHSNumParts; I < E; I+=2) {
       std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
       std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
-      if ((I & 1) == 0) { // Expect even part to always be alpha.
-        assert (LHSPart.first == false && RHSPart.first == false &&
-                "Expected both parts to be alpha.");
-        if (int Res = LHSPart.second.compare(RHSPart.second))
-          return Res < 0;
-      }
+      // Expect even part to always be alpha.
+      assert (LHSPart.first == false && RHSPart.first == false &&
+              "Expected both parts to be alpha.");
+      if (int Res = LHSPart.second.compare(RHSPart.second))
+        return Res < 0;
     }
     for (size_t I = 1, E = LHSNumParts; I < E; I+=2) {
       std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
       std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
-      if (I & 1) { // Expect odd part to always be numeric.
-        assert (LHSPart.first == true && RHSPart.first == true &&
-                "Expected both parts to be numeric.");
-        if (LHSPart.second.size() != RHSPart.second.size())
-          return LHSPart.second.size() < RHSPart.second.size();
+      // Expect odd part to always be numeric.
+      assert (LHSPart.first == true && RHSPart.first == true &&
+              "Expected both parts to be numeric.");
+      if (LHSPart.second.size() != RHSPart.second.size())
+        return LHSPart.second.size() < RHSPart.second.size();
 
-        unsigned LHSVal, RHSVal;
-        if (LHSPart.second.getAsInteger(10, LHSVal))
-          assert("Unable to convert LHS to integer.");
-        if (RHSPart.second.getAsInteger(10, RHSVal))
-          assert("Unable to convert RHS to integer.");
-        if (LHSVal != RHSVal)
-          return LHSVal < RHSVal;
-      }
+      unsigned LHSVal, RHSVal;
+      if (LHSPart.second.getAsInteger(10, LHSVal))
+        assert("Unable to convert LHS to integer.");
+      if (RHSPart.second.getAsInteger(10, RHSVal))
+        assert("Unable to convert RHS to integer.");
+      if (LHSVal != RHSVal)
+        return LHSVal < RHSVal;
     }
     return LHSNumParts < RHSNumParts;
   }





More information about the llvm-commits mailing list