Subzero: Reduce copying of Liveness bitvectors.
There were a lot of unnecessary copying and resizing and sloppiness in the use of BitVector for liveness analysis. This tries to reduce the amount of copying and associated memory allocation.
Also, works around a ConstantRelocatable hashing problem that was causing a huge slowdown in MINIMAL mode for the vector_shuffle scons test.
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1746613002 .
diff --git a/src/IceLiveness.cpp b/src/IceLiveness.cpp
index 2bfa624..d9e8e8a 100644
--- a/src/IceLiveness.cpp
+++ b/src/IceLiveness.cpp
@@ -106,6 +106,7 @@
RangeMask[VarIndex] = false;
}
+ SizeT MaxLocals = 0;
// Process each node.
for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) {
LivenessNode &Node = Nodes[(*I)->getIndex()];
@@ -113,7 +114,9 @@
Node.LiveIn.resize(NumGlobals);
Node.LiveOut.resize(NumGlobals);
// LiveBegin and LiveEnd are reinitialized before each pass over the block.
+ MaxLocals = std::max(MaxLocals, Node.NumLocals);
}
+ ScratchBV.reserve(NumGlobals + MaxLocals);
}
void Liveness::init() {