Limit the number of blocks handled by TraceBuilder::optimizeTrace

It appears to be O(N^3) in the number of blocks (a quick glance
at the code suggested N^2, but 1000 blocks took about .5s to process
while 2000 blocks took 4; 19000 blocks was nowhere near finished in
an hour). A better representation of the dominators would probably
solve this - but would also take *much* more space.
Having more than 1000 blocks appears to be extremely rare, so
this seems like a reasonable solution for now.
Esse commit está contido em:
mwilliams
2013-03-13 09:03:56 -07:00
commit de Sara Golemon
commit 97cf4e0e06
2 arquivos alterados com 7 adições e 0 exclusões
+1
Ver Arquivo
@@ -414,6 +414,7 @@ public:
F(bool, HHIRGenericDtorHelper, true) \
F(bool, HHIRCse, true) \
F(bool, HHIRSimplification, true) \
F(uint32_t, HHIRSimplificationMaxBlocks,1000) \
F(bool, HHIRGenOpts, true) \
F(bool, HHIRJumpOpts, true) \
F(bool, HHIRExtraOptPass, true) \
@@ -1522,6 +1522,12 @@ void TraceBuilder::optimizeTrace() {
m_enableCse = RuntimeOption::EvalHHIRCse;
m_enableSimplification = RuntimeOption::EvalHHIRSimplification;
if (!m_enableCse && !m_enableSimplification) return;
if (m_trace->getBlocks().size() >
RuntimeOption::EvalHHIRSimplificationMaxBlocks) {
// TODO CSEHash::filter is very slow for large block sizes
// t2135219 should address that
return;
}
BlockList sortedBlocks = sortCfg(m_trace.get(), m_irFactory);
IdomVector idoms = findDominators(sortedBlocks);
clearTrackedState();