summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2007-10-03 19:26:29 +0000
committerDan Gohman <gohman@apple.com>2007-10-03 19:26:29 +0000
commitc731c97facb5ff56daceb724d75f1f14e8d01f39 (patch)
tree700408f7fbcfb3dd5005afb0399dff630d61948b
parent8c43e41d9bf388195d4b1f32b569193c77ca404a (diff)
downloadbcm5719-llvm-c731c97facb5ff56daceb724d75f1f14e8d01f39.tar.gz
bcm5719-llvm-c731c97facb5ff56daceb724d75f1f14e8d01f39.zip
Use empty() member functions when that's what's being tested for instead
of comparing begin() and end(). llvm-svn: 42585
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp2
-rw-r--r--llvm/lib/Analysis/LoopPass.cpp4
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp20
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp2
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp2
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/IA64/IA64AsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/X86/X86ATTAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/X86/X86AsmPrinter.cpp6
-rw-r--r--llvm/lib/Target/X86/X86IntelAsmPrinter.cpp10
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp4
-rw-r--r--llvm/lib/Transforms/IPO/RaiseAllocations.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp2
-rw-r--r--llvm/lib/VMCore/Value.cpp4
17 files changed, 36 insertions, 38 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 0397af7e979..366909c0ebe 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -520,7 +520,7 @@ void AliasSet::print(std::ostream &OS) const {
OS << " forwarding to " << (void*)Forward;
- if (begin() != end()) {
+ if (!empty()) {
OS << "Pointers: ";
for (iterator I = begin(), E = end(); I != E; ++I) {
if (I != begin()) OS << ", ";
diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp
index 414769bff74..c53d85f1fdf 100644
--- a/llvm/lib/Analysis/LoopPass.cpp
+++ b/llvm/lib/Analysis/LoopPass.cpp
@@ -54,7 +54,7 @@ void LPPassManager::deleteLoopFromQueue(Loop *L) {
}
// Move all subloops into the parent loop.
- while (L->begin() != L->end())
+ while (!L->empty())
ParentLoop->addChildLoop(L->removeChildLoop(L->end()-1));
} else {
// Reparent all of the blocks in this loop. Since BBLoop had no parent,
@@ -78,7 +78,7 @@ void LPPassManager::deleteLoopFromQueue(Loop *L) {
}
// Move all of the subloops to the top-level.
- while (L->begin() != L->end())
+ while (!L->empty())
LI->addTopLevelLoop(L->removeChildLoop(L->end()-1));
}
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index e7abd47f536..88eeff7605a 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -817,17 +817,15 @@ void LiveIntervals::computeIntervals() {
MachineBasicBlock::iterator MI = MBB->begin(), miEnd = MBB->end();
- if (MBB->livein_begin() != MBB->livein_end()) {
- // Create intervals for live-ins to this BB first.
- for (MachineBasicBlock::const_livein_iterator LI = MBB->livein_begin(),
- LE = MBB->livein_end(); LI != LE; ++LI) {
- handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*LI));
- // Multiple live-ins can alias the same register.
- for (const unsigned* AS = mri_->getSubRegisters(*LI); *AS; ++AS)
- if (!hasInterval(*AS))
- handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*AS),
- true);
- }
+ // Create intervals for live-ins to this BB first.
+ for (MachineBasicBlock::const_livein_iterator LI = MBB->livein_begin(),
+ LE = MBB->livein_end(); LI != LE; ++LI) {
+ handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*LI));
+ // Multiple live-ins can alias the same register.
+ for (const unsigned* AS = mri_->getSubRegisters(*LI); *AS; ++AS)
+ if (!hasInterval(*AS))
+ handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*AS),
+ true);
}
for (; MI != miEnd; ++MI) {
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 134d2767861..6a8b083be83 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -119,7 +119,7 @@ void MachineBasicBlock::print(std::ostream &OS) const {
OS << ":\n";
const MRegisterInfo *MRI = MF->getTarget().getRegisterInfo();
- if (livein_begin() != livein_end()) {
+ if (!livein_empty()) {
OS << "Live Ins:";
for (const_livein_iterator I = livein_begin(),E = livein_end(); I != E; ++I)
OutputReg(OS, *I, MRI);
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index c762ae567c8..ca7468476ad 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -208,7 +208,7 @@ void MachineFunction::print(std::ostream &OS) const {
const MRegisterInfo *MRI = getTarget().getRegisterInfo();
- if (livein_begin() != livein_end()) {
+ if (!livein_empty()) {
OS << "Live Ins:";
for (livein_iterator I = livein_begin(), E = livein_end(); I != E; ++I) {
if (MRI)
@@ -221,7 +221,7 @@ void MachineFunction::print(std::ostream &OS) const {
}
OS << "\n";
}
- if (liveout_begin() != liveout_end()) {
+ if (!liveout_empty()) {
OS << "Live Outs:";
for (liveout_iterator I = liveout_begin(), E = liveout_end(); I != E; ++I)
if (MRI)
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index d90accda627..bd5c5983327 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -866,7 +866,7 @@ void ScheduleDAG::EmitSchedule() {
// that need to be copied into vregs, emit the copies into the top of the
// block before emitting the code for the block.
MachineFunction &MF = DAG.getMachineFunction();
- if (&MF.front() == BB && MF.livein_begin() != MF.livein_end()) {
+ if (&MF.front() == BB) {
for (MachineFunction::livein_iterator LI = MF.livein_begin(),
E = MF.livein_end(); LI != E; ++LI)
if (LI->second) {
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index 38183c6f12f..9435cc1174f 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -1001,7 +1001,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
O << "\n";
// Output non-lazy-pointers for external and common global variables.
- if (GVNonLazyPtrs.begin() != GVNonLazyPtrs.end())
+ if (!GVNonLazyPtrs.empty())
SwitchToDataSection(".non_lazy_symbol_pointer", 0);
for (std::set<std::string>::iterator i = GVNonLazyPtrs.begin(),
e = GVNonLazyPtrs.end(); i != e; ++i) {
diff --git a/llvm/lib/Target/IA64/IA64AsmPrinter.cpp b/llvm/lib/Target/IA64/IA64AsmPrinter.cpp
index cb2cf620afc..08a27d48ca2 100644
--- a/llvm/lib/Target/IA64/IA64AsmPrinter.cpp
+++ b/llvm/lib/Target/IA64/IA64AsmPrinter.cpp
@@ -147,7 +147,7 @@ bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block if there are any predecessors.
- if (I->pred_begin() != I->pred_end()) {
+ if (!I->pred_empty()) {
printBasicBlockLabel(I, true);
O << '\n';
}
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index b561c043da7..9ff41cab90c 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1053,7 +1053,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
O << "\n";
// Output stubs for external and common global variables.
- if (GVStubs.begin() != GVStubs.end()) {
+ if (!GVStubs.empty()) {
SwitchToDataSection(".non_lazy_symbol_pointer");
for (std::set<std::string>::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I) {
diff --git a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
index e53edff65d8..8e52e00f47a 100644
--- a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -168,7 +168,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (I->pred_begin() != I->pred_end()) {
+ if (!I->pred_empty()) {
printBasicBlockLabel(I, true);
O << '\n';
}
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index c4d5958bfca..7855e50e43d 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -316,7 +316,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
}
// Output linker support code for dllexported globals
- if (DLLExportedGVs.begin() != DLLExportedGVs.end()) {
+ if (!DLLExportedGVs.empty()) {
SwitchToDataSection(".section .drectve");
}
@@ -326,7 +326,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\t.ascii \" -export:" << *i << ",data\"\n";
}
- if (DLLExportedFns.begin() != DLLExportedFns.end()) {
+ if (!DLLExportedFns.empty()) {
SwitchToDataSection(".section .drectve");
}
@@ -362,7 +362,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
}
// Output stubs for external and common global variables.
- if (GVStubs.begin() != GVStubs.end())
+ if (!GVStubs.empty())
SwitchToDataSection(
".section __IMPORT,__pointers,non_lazy_symbol_pointers");
for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end();
diff --git a/llvm/lib/Target/X86/X86IntelAsmPrinter.cpp b/llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
index 72ba1b098bc..bd8886cd86a 100644
--- a/llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
@@ -77,7 +77,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block if there are any predecessors.
- if (I->pred_begin() != I->pred_end()) {
+ if (!I->pred_empty()) {
printBasicBlockLabel(I, true);
O << '\n';
}
@@ -412,8 +412,8 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
}
// Output linker support code for dllexported globals
- if ((DLLExportedGVs.begin() != DLLExportedGVs.end()) ||
- (DLLExportedFns.begin() != DLLExportedFns.end())) {
+ if (!DLLExportedGVs.empty() ||
+ !DLLExportedFns.empty()) {
SwitchToDataSection("");
O << "; WARNING: The following code is valid only with MASM v8.x and (possible) higher\n"
<< "; This version of MASM is usually shipped with Microsoft Visual Studio 2005\n"
@@ -434,8 +434,8 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
O << "\t db ' /EXPORT:" << *i << "'\n";
}
- if ((DLLExportedGVs.begin() != DLLExportedGVs.end()) ||
- (DLLExportedFns.begin() != DLLExportedFns.end())) {
+ if (!DLLExportedGVs.empty() ||
+ !DLLExportedFns.empty()) {
O << "_drectve\t ends\n";
}
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 85893d706fe..13739a5ea28 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -63,7 +63,7 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
// Remove any call graph edges from the callee to its callees.
CallGraphNode *CalleeNode = CG[Callee];
- while (CalleeNode->begin() != CalleeNode->end())
+ while (!CalleeNode->empty())
CalleeNode->removeCallEdgeTo((CalleeNode->end()-1)->second);
// Removing the node for callee from the call graph and delete it.
@@ -188,7 +188,7 @@ bool Inliner::doFinalization(CallGraph &CG) {
F->use_empty()) {
// Remove any call graph edges from the function to its callees.
- while (CGN->begin() != CGN->end())
+ while (!CGN->empty())
CGN->removeCallEdgeTo((CGN->end()-1)->second);
// Remove any edges from the external node to the function's call graph
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
index ed4a3769dbe..44702bc8179 100644
--- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -154,7 +154,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
if (Instruction *I = dyn_cast<Instruction>(U)) {
CallSite CS = CallSite::get(I);
- if (CS.getInstruction() && CS.arg_begin() != CS.arg_end() &&
+ if (CS.getInstruction() && !CS.arg_empty() &&
(CS.getCalledFunction() == MallocFunc ||
std::find(EqPointers.begin(), EqPointers.end(),
CS.getCalledValue()) != EqPointers.end())) {
@@ -205,7 +205,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
if (Instruction *I = dyn_cast<Instruction>(U)) {
CallSite CS = CallSite::get(I);
- if (CS.getInstruction() && CS.arg_begin() != CS.arg_end() &&
+ if (CS.getInstruction() && !CS.arg_empty() &&
(CS.getCalledFunction() == FreeFunc ||
std::find(EqPointers.begin(), EqPointers.end(),
CS.getCalledValue()) != EqPointers.end())) {
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index e795aa9c0c5..8a094aa9678 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -786,7 +786,7 @@ void LICM::FindPromotableValuesInLoop(
// volatile loads or stores.
if (!AS.isForwardingAliasSet() && AS.isMod() && AS.isMustAlias() &&
!AS.isVolatile() && CurLoop->isLoopInvariant(AS.begin()->first)) {
- assert(AS.begin() != AS.end() &&
+ assert(!AS.empty() &&
"Must alias set should have at least one pointer element in it!");
Value *V = AS.begin()->first;
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index dacaad01a3b..d236039332e 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1574,7 +1574,7 @@ bool IPSCCP::runOnModule(Module &M) {
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) {
BasicBlock *Succ = TI->getSuccessor(i);
- if (Succ->begin() != Succ->end() && isa<PHINode>(Succ->begin()))
+ if (!Succ->empty() && isa<PHINode>(Succ->begin()))
TI->getSuccessor(i)->removePredecessor(BB);
}
if (!TI->use_empty())
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index 0150c7e6e96..de6c16b5214 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -47,14 +47,14 @@ Value::~Value() {
// still being referenced. The value in question should be printed as
// a <badref>
//
- if (use_begin() != use_end()) {
+ if (!use_empty()) {
DOUT << "While deleting: " << *Ty << " %" << Name << "\n";
for (use_iterator I = use_begin(), E = use_end(); I != E; ++I)
DOUT << "Use still stuck around after Def is destroyed:"
<< **I << "\n";
}
#endif
- assert(use_begin() == use_end() && "Uses remain when a value is destroyed!");
+ assert(use_empty() && "Uses remain when a value is destroyed!");
// If this value is named, destroy the name. This should not be in a symtab
// at this point.
OpenPOWER on IntegriCloud