[llvm-commits] [llvm] r54780 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h include/llvm/CodeGen/MachineLoopInfo.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LoopAligner.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/StrongPHIElimination.cpp lib/Transforms/IPO/LoopExtractor.cpp lib/Transforms/Scalar/LoopIndexSplit.cpp lib/Transforms/Utils/SimplifyCFG.cpp

Dan Gohman gohman at apple.com
Thu Aug 14 11:13:53 PDT 2008


Author: djg
Date: Thu Aug 14 13:13:49 2008
New Revision: 54780

URL: http://llvm.org/viewvc/llvm-project?rev=54780&view=rev
Log:
Use empty() instead of begin() == end().

Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfo.h
    llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h
    llvm/trunk/lib/CodeGen/LiveInterval.cpp
    llvm/trunk/lib/CodeGen/LoopAligner.cpp
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
    llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp
    llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Thu Aug 14 13:13:49 2008
@@ -648,6 +648,7 @@
   typedef typename std::vector<LoopBase<BlockT>*>::const_iterator iterator;
   iterator begin() const { return TopLevelLoops.begin(); }
   iterator end() const { return TopLevelLoops.end(); }
+  bool empty() const { return TopLevelLoops.empty(); }
   
   /// getLoopFor - Return the inner most loop that BB lives in.  If a basic
   /// block is in no loop (for example the entry node), null is returned.
@@ -947,6 +948,7 @@
   typedef std::vector<Loop*>::const_iterator iterator;
   inline iterator begin() const { return LI->begin(); }
   inline iterator end() const { return LI->end(); }
+  bool empty() const { return LI->empty(); }
 
   /// getLoopFor - Return the inner most loop that BB lives in.  If a basic
   /// block is in no loop (for example the entry node), null is returned.

Modified: llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h Thu Aug 14 13:13:49 2008
@@ -92,6 +92,7 @@
   typedef std::vector<MachineLoop*>::const_iterator iterator;
   inline iterator begin() const { return LI->begin(); }
   inline iterator end() const { return LI->end(); }
+  bool empty() const { return LI->empty(); }
 
   /// getLoopFor - Return the inner most loop that BB lives in.  If a basic
   /// block is in no loop (for example the entry node), null is returned.

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Aug 14 13:13:49 2008
@@ -547,7 +547,7 @@
 /// used with an unknown definition value.
 void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
                                         BumpPtrAllocator &VNInfoAllocator) {
-  if (Clobbers.begin() == Clobbers.end()) return;
+  if (Clobbers.empty()) return;
   
   // Find a value # to use for the clobber ranges.  If there is already a value#
   // for unknown values, use it.

Modified: llvm/trunk/lib/CodeGen/LoopAligner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LoopAligner.cpp?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LoopAligner.cpp (original)
+++ llvm/trunk/lib/CodeGen/LoopAligner.cpp Thu Aug 14 13:13:49 2008
@@ -46,7 +46,7 @@
 bool LoopAligner::runOnMachineFunction(MachineFunction &MF) {
   const MachineLoopInfo *MLI = &getAnalysis<MachineLoopInfo>();
 
-  if (MLI->begin() == MLI->end())
+  if (MLI->empty())
     return false;  // No loops.
 
   const TargetLowering *TLI = MF.getTarget().getTargetLowering();

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Aug 14 13:13:49 2008
@@ -1852,7 +1852,7 @@
     JoinQueue = new JoinPriorityQueue<CopyRecSort>(this);
 
   std::vector<CopyRec> TryAgainList;
-  if (loopInfo->begin() == loopInfo->end()) {
+  if (loopInfo->empty()) {
     // If there are no loops in the function, join intervals in function order.
     for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();
          I != E; ++I)
@@ -2049,7 +2049,7 @@
   CopyMI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF));
   for (int i = CopyMI->getNumOperands() - 1, e = 0; i > e; --i)
     CopyMI->RemoveOperand(i);
-  bool NoUse = mri_->use_begin(SrcReg) == mri_->use_end();
+  bool NoUse = mri_->use_empty(SrcReg);
   if (NoUse) {
     for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg),
            E = mri_->reg_end(); I != E; ) {

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Thu Aug 14 13:13:49 2008
@@ -848,7 +848,7 @@
     RHS.removeValNo(*VI);
   }
   
-  if (RHS.begin() == RHS.end())
+  if (RHS.empty())
     LI.removeInterval(RHS.reg);
 }
 

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

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp Thu Aug 14 13:13:49 2008
@@ -79,7 +79,7 @@
   LoopInfo &LI = getAnalysis<LoopInfo>();
 
   // If this function has no loops, there is nothing to do.
-  if (LI.begin() == LI.end())
+  if (LI.empty())
     return false;
 
   DominatorTree &DT = getAnalysis<DominatorTree>();

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Aug 14 13:13:49 2008
@@ -1006,9 +1006,9 @@
 
   // Remove split condition.
   SD.SplitCondition->eraseFromParent();
-  if (Op0->use_begin() == Op0->use_end())
+  if (Op0->use_empty())
     Op0->eraseFromParent();
-  if (Op1->use_begin() == Op1->use_end())
+  if (Op1->use_empty())
     Op1->eraseFromParent();
       
   BranchInst *ExitInsn =

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=54780&r1=54779&r2=54780&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Aug 14 13:13:49 2008
@@ -107,7 +107,7 @@
       CommonPreds.insert(*PI);
 
   // Shortcut, if there are no common predecessors, merging is always safe
-  if (CommonPreds.begin() == CommonPreds.end())
+  if (CommonPreds.empty())
     return true;
   
   // Look at all the phi nodes in Succ, to see if they present a conflict when





More information about the llvm-commits mailing list