diff options
author | Dan Gohman <gohman@apple.com> | 2008-08-14 18:13:49 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-08-14 18:13:49 +0000 |
commit | a8c763b3071ae1a58ee8baeb282331245527e004 (patch) | |
tree | ae6a11d42901b80c9db1408f7dc3850f114b030c | |
parent | c1f1d46f000eacceaa861e5b083ef0424cb9b41a (diff) | |
download | external_llvm-a8c763b3071ae1a58ee8baeb282331245527e004.zip external_llvm-a8c763b3071ae1a58ee8baeb282331245527e004.tar.gz external_llvm-a8c763b3071ae1a58ee8baeb282331245527e004.tar.bz2 |
Use empty() instead of begin() == end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineLoopInfo.h | 1 | ||||
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/LoopAligner.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/StrongPHIElimination.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/LoopExtractor.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 2 |
9 files changed, 12 insertions, 9 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index e22f22f..1b684d7 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -648,6 +648,7 @@ public: 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 @@ public: 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. diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h index 8b46825..fa2d229 100644 --- a/include/llvm/CodeGen/MachineLoopInfo.h +++ b/include/llvm/CodeGen/MachineLoopInfo.h @@ -92,6 +92,7 @@ public: 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. diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index 0f5de92..ff430d7 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -547,7 +547,7 @@ void LiveInterval::MergeValueInAsValue(const LiveInterval &RHS, /// 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. diff --git a/lib/CodeGen/LoopAligner.cpp b/lib/CodeGen/LoopAligner.cpp index 1888391..44f5bb4 100644 --- a/lib/CodeGen/LoopAligner.cpp +++ b/lib/CodeGen/LoopAligner.cpp @@ -46,7 +46,7 @@ FunctionPass *llvm::createLoopAlignerPass() { return new LoopAligner(); } 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(); diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index b3e3409..72db79d 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -1852,7 +1852,7 @@ void SimpleRegisterCoalescing::joinIntervals() { 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 @@ SimpleRegisterCoalescing::TurnCopyIntoImpDef(MachineBasicBlock::iterator &I, 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; ) { diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 37f54ce..9f59417 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -848,7 +848,7 @@ void StrongPHIElimination::mergeLiveIntervals(unsigned primary, RHS.removeValNo(*VI); } - if (RHS.begin() == RHS.end()) + if (RHS.empty()) LI.removeInterval(RHS.reg); } diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp index 10ec306..8e55b3f 100644 --- a/lib/Transforms/IPO/LoopExtractor.cpp +++ b/lib/Transforms/IPO/LoopExtractor.cpp @@ -79,7 +79,7 @@ bool LoopExtractor::runOnFunction(Function &F) { 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>(); diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 135ce33..1ab9a18 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -1006,9 +1006,9 @@ bool LoopIndexSplit::updateLoopIterationSpace(SplitInfo &SD) { // 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 = diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index d04fce6..efd1765 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -107,7 +107,7 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { 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 |