Compiler constant handling rework
In preparation for de-optimization, reworked the constant
handling mechanism. Also took advantage of knowledge of
constant operands (particularly for long operations).
Significant performance improvements for Mandelbrot
(~60 seconds to ~34 seconds). Minor improvements in other
benchmarks.
The new constant handling breaks two of the existing
optimization passes: "Skip Large Method" and "Load/Store
Elimization."
I don't intend to update the large method optimization
because it will be superceeded by the upcoming interpreter/
fingerprinting mechanism. Leaving the code in place for
now in order to compare compile-time improvements with
fingerprinting/interpret. All related code will be deleted
when that is complete.
The load/store elimination pass needs some rework to handle
uses of multiple-register loads and stores. It will be
updated & restored in a future CL.
Change-Id: Ia979abaf51b8ae81bbb0428031cbcea854625fac
diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc
index 6ccbc07..6eb117a 100644
--- a/src/compiler/frontend.cc
+++ b/src/compiler/frontend.cc
@@ -66,13 +66,13 @@
/* Default optimizer/debug setting for the compiler. */
static uint32_t kCompilerOptimizerDisableFlags = 0 | // Disable specific optimizations
- //(1 << kLoadStoreElimination) |
+ (1 << kLoadStoreElimination) |
//(1 << kLoadHoisting) |
//(1 << kSuppressLoads) |
//(1 << kNullCheckElimination) |
//(1 << kPromoteRegs) |
//(1 << kTrackLiveTemps) |
- //(1 << kSkipLargeMethodOptimization) |
+ (1 << kSkipLargeMethodOptimization) |
//(1 << kSafeOptimizations) |
//(1 << kBBOpt) |
//(1 << kMatch) |
@@ -972,6 +972,7 @@
cur_block = ProcessCanBranch(cu.get(), cur_block, insn, cur_offset,
width, flags, code_ptr, code_end);
} else if (flags & Instruction::kReturn) {
+ cur_block->has_return = true;
cur_block->fall_through = exit_block;
InsertGrowableList(cu.get(), exit_block->predecessors,
reinterpret_cast<uintptr_t>(cur_block));
@@ -1078,10 +1079,9 @@
}
/* Do constant propagation */
- // TODO: Probably need to make these expandable to support new ssa names
- // introducted during MIR optimization passes
- cu->is_constant_v = AllocBitVector(cu.get(), cu->num_ssa_regs,
- false /* not expandable */);
+ cu->is_constant_v = AllocBitVector(cu.get(), cu->num_ssa_regs, false /* not expandable */);
+ cu->must_flush_constant_v = AllocBitVector(cu.get(), cu->num_ssa_regs,
+ false /* not expandable */);
cu->constant_values =
static_cast<int*>(NewMem(cu.get(), sizeof(int) * cu->num_ssa_regs, true, kAllocDFInfo));
DataFlowAnalysisDispatcher(cu.get(), DoConstantPropogation,