Index: llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h =================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h +++ llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h @@ -35,7 +35,7 @@ SmallPtrSet AliveGlobals; /// Global -> Global that uses this global. - std::unordered_multimap GVDependencies; + DenseMap> GVDependencies; /// Constant -> Globals that use this global cache. std::unordered_map> Index: llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp +++ llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp @@ -115,7 +115,7 @@ ComputeDependencies(User, Deps); Deps.erase(&GV); // Remove self-reference. for (GlobalValue *GVU : Deps) { - GVDependencies.insert(std::make_pair(GVU, &GV)); + GVDependencies[GVU].insert(&GV); } } @@ -199,8 +199,8 @@ AliveGlobals.end()}; while (!NewLiveGVs.empty()) { GlobalValue *LGV = NewLiveGVs.pop_back_val(); - for (auto &&GVD : make_range(GVDependencies.equal_range(LGV))) - MarkLive(*GVD.second, &NewLiveGVs); + for (auto *GVD : GVDependencies[LGV]) + MarkLive(*GVD, &NewLiveGVs); } // Now that all globals which are needed are in the AliveGlobals set, we loop