diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 720bef85798..7713a5b6476 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -97,7 +97,7 @@ class GlobalsModRef : public ModulePass, public AliasAnalysis { /// AllocsForIndirectGlobals - If an instruction allocates memory for an /// indirect global, this map indicates which one. - std::map AllocsForIndirectGlobals; + DenseMap AllocsForIndirectGlobals; /// FunctionInfo - For each function, keep track of what globals are /// modified or read. @@ -120,16 +120,11 @@ class GlobalsModRef : public ModulePass, public AliasAnalysis { // any AllocRelatedValues for it. if (GMR.IndirectGlobals.erase(GV)) { // Remove any entries in AllocsForIndirectGlobals for this global. - for (std::map::iterator - I = GMR.AllocsForIndirectGlobals.begin(), - E = GMR.AllocsForIndirectGlobals.end(); - I != E;) { - if (I->second == GV) { - GMR.AllocsForIndirectGlobals.erase(I++); - } else { - ++I; - } - } + for (auto I = GMR.AllocsForIndirectGlobals.begin(), + E = GMR.AllocsForIndirectGlobals.end(); + I != E; ++I) + if (I->second == GV) + GMR.AllocsForIndirectGlobals.erase(I); } } }