[llvm-commits] [llvm] r42585 - in /llvm/trunk/lib: Analysis/ CodeGen/ CodeGen/SelectionDAG/ Target/ARM/ Target/IA64/ Target/PowerPC/ Target/X86/ Transforms/IPO/ Transforms/Scalar/ VMCore/
Dan Gohman
djg at cray.com
Wed Oct 3 12:26:29 PDT 2007
Author: djg
Date: Wed Oct 3 14:26:29 2007
New Revision: 42585
URL: http://llvm.org/viewvc/llvm-project?rev=42585&view=rev
Log:
Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().
Modified:
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
llvm/trunk/lib/Analysis/LoopPass.cpp
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp
llvm/trunk/lib/Transforms/IPO/Inliner.cpp
llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
llvm/trunk/lib/VMCore/Value.cpp
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Oct 3 14:26:29 2007
@@ -520,7 +520,7 @@
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 << ", ";
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Wed Oct 3 14:26:29 2007
@@ -54,7 +54,7 @@
}
// 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 @@
}
// Move all of the subloops to the top-level.
- while (L->begin() != L->end())
+ while (!L->empty())
LI->addTopLevelLoop(L->removeChildLoop(L->end()-1));
}
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Oct 3 14:26:29 2007
@@ -817,17 +817,15 @@
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) {
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Wed Oct 3 14:26:29 2007
@@ -119,7 +119,7 @@
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);
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Oct 3 14:26:29 2007
@@ -208,7 +208,7 @@
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 @@
}
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)
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Oct 3 14:26:29 2007
@@ -866,7 +866,7 @@
// 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) {
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -1001,7 +1001,7 @@
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) {
Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -147,7 +147,7 @@
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';
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -1053,7 +1053,7 @@
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) {
Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -168,7 +168,7 @@
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';
}
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -316,7 +316,7 @@
}
// Output linker support code for dllexported globals
- if (DLLExportedGVs.begin() != DLLExportedGVs.end()) {
+ if (!DLLExportedGVs.empty()) {
SwitchToDataSection(".section .drectve");
}
@@ -326,7 +326,7 @@
O << "\t.ascii \" -export:" << *i << ",data\"\n";
}
- if (DLLExportedFns.begin() != DLLExportedFns.end()) {
+ if (!DLLExportedFns.empty()) {
SwitchToDataSection(".section .drectve");
}
@@ -362,7 +362,7 @@
}
// 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();
Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Wed Oct 3 14:26:29 2007
@@ -77,7 +77,7 @@
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 @@
}
// 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 @@
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";
}
Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Oct 3 14:26:29 2007
@@ -63,7 +63,7 @@
// 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 @@
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
Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Wed Oct 3 14:26:29 2007
@@ -154,7 +154,7 @@
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 @@
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())) {
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Oct 3 14:26:29 2007
@@ -786,7 +786,7 @@
// 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;
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Oct 3 14:26:29 2007
@@ -1574,7 +1574,7 @@
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())
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=42585&r1=42584&r2=42585&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Wed Oct 3 14:26:29 2007
@@ -47,14 +47,14 @@
// 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.
More information about the llvm-commits
mailing list