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/IceCfg.cpp b/src/IceCfg.cpp
index 5c51ae6..5e5957e 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -1076,6 +1076,14 @@
emitJumpTables();
}
+size_t Cfg::getTotalMemoryMB() {
+ constexpr size_t OneMB = 1024 * 1024;
+ using ArbitraryType = int;
+ // CfgLocalAllocator draws from the same memory pool regardless of allocated
+ // object type, so pick an arbitrary type for the template parameter.
+ return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB;
+}
+
// Dumps the IR with an optional introductory message.
void Cfg::dump(const IceString &Message) {
if (!BuildDefs::dump())
@@ -1087,10 +1095,7 @@
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