[llvm-commits] [llvm] r46514 - in /llvm/trunk/lib: Archive/ Bitcode/Reader/ CodeGen/ CodeGen/SelectionDAG/ ExecutionEngine/Interpreter/ System/Win32/ Transforms/IPO/ Transforms/Scalar/

Dan Gohman djg at cray.com
Tue Jan 29 05:02:09 PST 2008


Author: djg
Date: Tue Jan 29 07:02:09 2008
New Revision: 46514

URL: http://llvm.org/viewvc/llvm-project?rev=46514&view=rev
Log:
Use empty() instead of comparing size() with zero.

Modified:
    llvm/trunk/lib/Archive/ArchiveReader.cpp
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp
    llvm/trunk/lib/CodeGen/BranchFolding.cpp
    llvm/trunk/lib/CodeGen/IfConversion.cpp
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
    llvm/trunk/lib/System/Win32/Path.inc
    llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp

Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Archive/ArchiveReader.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveReader.cpp Tue Jan 29 07:02:09 2008
@@ -588,7 +588,7 @@
 bool Archive::isBitcodeArchive() {
   // Make sure the symTab has been loaded. In most cases this should have been
   // done when the archive was constructed, but still,  this is just in case.
-  if (!symTab.size())
+  if (symTab.empty())
     if (!loadSymbolTable(0))
       return false;
 

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 29 07:02:09 2008
@@ -1327,7 +1327,7 @@
     }
     
     case bitc::FUNC_CODE_INST_RET: // RET: [opty,opval<optional>]
-      if (Record.size() == 0) {
+      if (Record.empty()) {
         I = new ReturnInst();
         break;
       } else {

Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Tue Jan 29 07:02:09 2008
@@ -115,7 +115,7 @@
   if (Stream.AtEndOfStream())
     return;
   
-  assert (Record.size() == 0);
+  assert (Record.empty());
   assert (AbbrevNo >= bitc::UNABBREV_RECORD);
   RecordCode = Stream.ReadRecord(AbbrevNo,Record);
   assert (Record.size() > 0);

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Jan 29 07:02:09 2008
@@ -646,7 +646,7 @@
             } else if (FBB) {
               if (TBB!=IBB && FBB!=IBB)   // cbr then ubr
                 continue;
-            } else if (Cond.size() == 0) {
+            } else if (Cond.empty()) {
               if (TBB!=IBB)               // ubr
                 continue;
             } else {

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Tue Jan 29 07:02:09 2008
@@ -237,7 +237,7 @@
 
   // Look for root nodes, i.e. blocks without successors.
   for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
-    if (I->succ_size() == 0)
+    if (I->succ_empty())
       Roots.push_back(I);
 
   std::vector<IfcvtToken*> Tokens;
@@ -428,7 +428,7 @@
 
     unsigned Size = TrueBBI.NonPredSize;
     if (TrueBBI.IsBrAnalyzable) {
-      if (TrueBBI.TrueBB && TrueBBI.BrCond.size() == 0)
+      if (TrueBBI.TrueBB && TrueBBI.BrCond.empty())
         // End with an unconditional branch. It will be removed.
         --Size;
       else {
@@ -646,7 +646,7 @@
   ScanInstructions(BBI);
 
   // Unanalyable or ends with fallthrough or unconditional branch.
-  if (!BBI.IsBrAnalyzable || BBI.BrCond.size() == 0) {
+  if (!BBI.IsBrAnalyzable || BBI.BrCond.empty()) {
     BBI.IsBeingAnalyzed = false;
     BBI.IsAnalyzed = true;
     return BBI;

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Jan 29 07:02:09 2008
@@ -1784,7 +1784,7 @@
     }
 
     // Remove landing pads with no try-ranges.
-    if (!LandingPads[i].BeginLabels.size()) {
+    if (LandingPads[i].BeginLabels.empty()) {
       LandingPads.erase(LandingPads.begin() + i);
       continue;
     }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Jan 29 07:02:09 2008
@@ -801,7 +801,7 @@
 
   // If we've change things around then replace token factor.
   if (Changed) {
-    if (Ops.size() == 0) {
+    if (Ops.empty()) {
       // The entry token is the only possible outcome.
       Result = DAG.getEntryNode();
     } else {

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Tue Jan 29 07:02:09 2008
@@ -230,7 +230,7 @@
 void ScheduleDAG::CalculateDepths() {
   std::vector<std::pair<SUnit*, unsigned> > WorkList;
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i)
-    if (SUnits[i].Preds.size() == 0)
+    if (SUnits[i].Preds.empty())
       WorkList.push_back(std::make_pair(&SUnits[i], 0U));
 
   while (!WorkList.empty()) {

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Tue Jan 29 07:02:09 2008
@@ -169,7 +169,7 @@
   // All leaves to Available queue.
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
     // It is available if it has no predecessors.
-    if (SUnits[i].Preds.size() == 0 && &SUnits[i] != Entry) {
+    if (SUnits[i].Preds.empty() && &SUnits[i] != Entry) {
       AvailableQueue->push(&SUnits[i]);
       SUnits[i].isAvailable = SUnits[i].isPending = true;
     }
@@ -477,7 +477,7 @@
   std::vector<std::pair<const SUnit*, unsigned> > WorkList;
   for (unsigned i = 0, e = SUnits->size(); i != e; ++i) {
     const SUnit *SU = &(*SUnits)[i];
-    if (SU->Succs.size() == 0)
+    if (SU->Succs.empty())
       WorkList.push_back(std::make_pair(SU, 0U));
   }
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Jan 29 07:02:09 2008
@@ -898,7 +898,7 @@
   // All leaves to Available queue.
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
     // It is available if it has no predecessors.
-    if (SUnits[i].Preds.size() == 0 && &SUnits[i] != Entry) {
+    if (SUnits[i].Preds.empty() && &SUnits[i] != Entry) {
       AvailableQueue->push(&SUnits[i]);
       SUnits[i].isAvailable = true;
     }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jan 29 07:02:09 2008
@@ -3497,7 +3497,7 @@
 bool SDNode::hasAnyUseOfValue(unsigned Value) const {
   assert(Value < getNumValues() && "Bad value!");
 
-  if (use_size() == 0) return false;
+  if (use_empty()) return false;
 
   SDOperand TheValue(const_cast<SDNode *>(this), Value);
 

Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Tue Jan 29 07:02:09 2008
@@ -257,7 +257,7 @@
 
 // double drand48()
 GenericValue lle_X_drand48(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.DoubleVal = drand48();
   return GV;
@@ -265,7 +265,7 @@
 
 // long lrand48()
 GenericValue lle_X_lrand48(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.IntVal = APInt(32, lrand48());
   return GV;
@@ -282,7 +282,7 @@
 
 // int rand()
 GenericValue lle_X_rand(FunctionType *FT, const vector<GenericValue> &Args) {
-  assert(Args.size() == 0);
+  assert(Args.empty());
   GenericValue GV;
   GV.IntVal = APInt(32, rand());
   return GV;

Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Tue Jan 29 07:02:09 2008
@@ -418,7 +418,7 @@
 
 bool
 Path::set(const std::string& a_path) {
-  if (a_path.size() == 0)
+  if (a_path.empty())
     return false;
   std::string save(path);
   path = a_path;

Modified: llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp Tue Jan 29 07:02:09 2008
@@ -740,7 +740,7 @@
     
     // If the constant string's length is zero we can optimize this by just
     // doing a store of 0 at the first byte of the destination
-    if (SrcStr.size() == 0) {
+    if (SrcStr.empty()) {
       new StoreInst(ConstantInt::get(Type::Int8Ty, 0), Dst, CI);
       return ReplaceCallWith(CI, Dst);
     }

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Tue Jan 29 07:02:09 2008
@@ -476,7 +476,7 @@
       while (isa<PHINode>(InsertPt)) ++InsertPt;
       ExitBlocks[0]->getInstList().insert(InsertPt, &I);
     }
-  } else if (ExitBlocks.size() == 0) {
+  } else if (ExitBlocks.empty()) {
     // The instruction is actually dead if there ARE NO exit blocks.
     CurAST->deleteValue(&I);
     if (!I.use_empty())  // If I has users in unreachable blocks, eliminate.

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Jan 29 07:02:09 2008
@@ -1214,7 +1214,7 @@
                                                       Loop *L,
                                                       bool isOnlyStride) {
   // If all the users are moved to another stride, then there is nothing to do.
-  if (Uses.Users.size() == 0)
+  if (Uses.Users.empty())
     return;
 
   // Keep track if every use in UsersToProcess is an address. If they all are,

Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=46514&r1=46513&r2=46514&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Tue Jan 29 07:02:09 2008
@@ -722,7 +722,7 @@
       
       ++NumFactor;
       
-      if (Ops.size() == 0)
+      if (Ops.empty())
         return V2;
 
       // Add the new value to the list of things being added.





More information about the llvm-commits mailing list