[PATCH] D38916: [GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies.
Michael Zolotukhin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 16:47:20 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316045: [GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies. (authored by mzolotukhin).
Repository:
rL LLVM
https://reviews.llvm.org/D38916
Files:
llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h
llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp
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<GlobalValue*, 32> AliveGlobals;
/// Global -> Global that uses this global.
- std::unordered_multimap<GlobalValue *, GlobalValue *> GVDependencies;
+ DenseMap<GlobalValue *, SmallPtrSet<GlobalValue *, 4>> GVDependencies;
/// Constant -> Globals that use this global cache.
std::unordered_map<Constant *, SmallPtrSet<GlobalValue *, 8>>
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38916.119402.patch
Type: text/x-patch
Size: 1522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171017/ef0994b7/attachment.bin>
More information about the llvm-commits
mailing list