From ff4196adcf602cbe0581f3240c3fef0847159550 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 27 Jun 2013 20:19:13 +0000 Subject: [PATCH] Remove unnecessary conditional checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185096 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/TableGen/Record.h | 38 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h index 63b72c8a738..a07898a955c 100644 --- a/include/llvm/TableGen/Record.h +++ b/include/llvm/TableGen/Record.h @@ -1782,30 +1782,28 @@ struct LessRecordRegister { for (size_t I = 0, E = LHSNumParts; I < E; I+=2) { std::pair LHSPart = LHSParts.getPart(I); std::pair 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 LHSPart = LHSParts.getPart(I); std::pair 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; } -- 2.34.1