Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: src/IceCfg.cpp

Issue 1746613002: Subzero: Reduce copying of Liveness bitvectors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix huge perf problem in MINIMAL build Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 5c51ae6d3893316efe28aff8793de937b902931b..7df55f523f5c919fd8257845928c4c3b57387262 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -334,12 +334,13 @@ void Cfg::advancedPhiLowering() {
getLiveness()->initPhiEdgeSplits(Nodes.begin() + NumNodes,
Variables.begin() + NumVars);
TimerMarker TTT(TimerStack::TT_liveness, this);
+ LivenessBV ScratchBV;
// Iterate over the newly added nodes to add their liveness info.
for (auto I = Nodes.begin() + NumNodes, E = Nodes.end(); I != E; ++I) {
InstNumberT FirstInstNum = getNextInstNumber();
(*I)->renumberInstructions();
InstNumberT LastInstNum = getNextInstNumber() - 1;
- (*I)->liveness(getLiveness());
+ (*I)->liveness(getLiveness(), &ScratchBV);
John 2016/02/29 15:12:31 make scratchbv a member of Liveness?
Jim Stichnoth 2016/02/29 22:58:26 Done.
(*I)->livenessAddIntervals(getLiveness(), FirstInstNum, LastInstNum);
}
} else {
@@ -820,12 +821,13 @@ void Cfg::liveness(LivenessMode Mode) {
Live->init();
// Initialize with all nodes needing to be processed.
BitVector NeedToProcess(Nodes.size(), true);
+ LivenessBV ScratchBV;
while (NeedToProcess.any()) {
// Iterate in reverse topological order to speed up convergence.
for (CfgNode *Node : reverse_range(Nodes)) {
if (NeedToProcess[Node->getIndex()]) {
NeedToProcess[Node->getIndex()] = false;
- bool Changed = Node->liveness(getLiveness());
+ bool Changed = Node->liveness(getLiveness(), &ScratchBV);
if (Changed) {
// If the beginning-of-block liveness changed since the last
// iteration, mark all in-edges as needing to be processed.
@@ -1076,6 +1078,11 @@ void Cfg::emitIAS() {
emitJumpTables();
}
+size_t Cfg::getTotalMemoryMB() {
+ constexpr size_t OneMB = 1024 * 1024;
+ return (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB);
John 2016/02/29 15:12:30 Add a comment explaining why int and not something
Jim Stichnoth 2016/02/29 22:58:26 Done.
+}
+
// Dumps the IR with an optional introductory message.
void Cfg::dump(const IceString &Message) {
if (!BuildDefs::dump())
@@ -1087,10 +1094,7 @@ void Cfg::dump(const IceString &Message) {
if (!Message.empty())
Str << "================ " << Message << " ================\n";
if (isVerbose(IceV_Mem)) {
- constexpr size_t OneMB = 1024 * 1024;
- Str << "Memory size = "
- << (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB)
- << " MB\n";
+ Str << "Memory size = " << getTotalMemoryMB() << " MB\n";
}
setCurrentNode(getEntryNode());
// Print function name+args

Powered by Google App Engine
This is Rietveld 408576698