From 4ef3e45d7c6ec3c482a1a48f4df470811aa3cf0a Mon Sep 17 00:00:00 2001 From: buzbee Date: Fri, 14 Dec 2012 13:35:28 -0800 Subject: 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 --- src/compiler/frontend.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/compiler/frontend.cc') diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc index 6ccbc07180..6eb117a200 100644 --- a/src/compiler/frontend.cc +++ b/src/compiler/frontend.cc @@ -66,13 +66,13 @@ extern "C" void ArtUnInitQuickCompilerContext(art::Compiler& compiler) { /* 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 @@ static CompiledMethod* CompileMethod(Compiler& compiler, 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(cur_block)); @@ -1078,10 +1079,9 @@ static CompiledMethod* CompileMethod(Compiler& compiler, } /* 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(NewMem(cu.get(), sizeof(int) * cu->num_ssa_regs, true, kAllocDFInfo)); DataFlowAnalysisDispatcher(cu.get(), DoConstantPropogation, -- cgit v1.2.3-59-g8ed1b