Remove unnecessary conditional checks.
authorChad Rosier <mcrosier@apple.com>
Thu, 27 Jun 2013 20:19:13 +0000 (20:19 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 27 Jun 2013 20:19:13 +0000 (20:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185096 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/TableGen/Record.h

index 63b72c8a73828d0a0b52f5007511707c477c6d2f..a07898a955c77e2e9c3a9af9cd6b4696b9f15b2b 100644 (file)
@@ -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();
-
-        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;
-      }
+      // 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;
     }
     return LHSNumParts < RHSNumParts;
   }