// set to keep track of which "available" allocas are being used by this
// function. Also, AllocasForType can be empty of course!
bool MergedAwayAlloca = false;
- for (unsigned i = 0, e = AllocasForType.size(); i != e; ++i) {
- AllocaInst *AvailableAlloca = AllocasForType[i];
+ for (AllocaInst *AvailableAlloca : AllocasForType) {
unsigned Align1 = AI->getAlignment(),
Align2 = AvailableAlloca->getAlignment();
// Scan for all of the functions, looking for ones that should now be removed
// from the program. Insert the dead ones in the FunctionsToRemove set.
- for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) {
- CallGraphNode *CGN = I->second;
+ for (auto I : CG) {
+ CallGraphNode *CGN = I.second;
Function *F = CGN->getFunction();
if (!F || F->isDeclaration())
continue;
FunctionsToRemove.erase(std::unique(FunctionsToRemove.begin(),
FunctionsToRemove.end()),
FunctionsToRemove.end());
- for (SmallVectorImpl<CallGraphNode *>::iterator I = FunctionsToRemove.begin(),
- E = FunctionsToRemove.end();
- I != E; ++I) {
- delete CG.removeFunctionFromModule(*I);
+ for (CallGraphNode *CGN : FunctionsToRemove) {
+ delete CG.removeFunctionFromModule(CGN);
++NumDeleted;
}
return true;