diff options
| author | 2012-04-24 18:02:24 +0800 | |
|---|---|---|
| committer | 2012-05-01 22:15:07 -0700 | |
| commit | ef4a6564254012b7ba00d6310521b1c0d938bdac (patch) | |
| tree | f8baca905b3ea99e3b116d99833ea520448552e8 /src/compiler_llvm/method_compiler.cc | |
| parent | 6ee997605c9f5a029250e50330ac764d1eb8112a (diff) | |
Remove unnecessary zero-initializer.
Dex verifier will guarantee that a Dalvik register will be
initialized before any usage. So we don't have to generate
the code to initialize them to 0 after allocation.
NOTE: We wrote the zero-initializer for historical reason.
There was a bug in the implementation of SHL, SHR, USHR,
and result in undef value after optimization. Since we
have found the bug, and we don't get undef any more, it's
time to remove these zero-initializer to save code size
and run time.
Change-Id: I0375af3bed08495f6743699c7a72c295cad71dfa
Diffstat (limited to 'src/compiler_llvm/method_compiler.cc')
| -rw-r--r-- | src/compiler_llvm/method_compiler.cc | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc index 1253d377c3..52807e36ca 100644 --- a/src/compiler_llvm/method_compiler.cc +++ b/src/compiler_llvm/method_compiler.cc @@ -63,7 +63,7 @@ MethodCompiler::MethodCompiler(CompilationUnit* cunit, irb_(*cunit->GetIRBuilder()), func_(NULL), retval_reg_(NULL), basic_block_stack_overflow_(NULL), basic_block_reg_alloca_(NULL), basic_block_shadow_frame_alloca_(NULL), - basic_block_reg_zero_init_(NULL), basic_block_reg_arg_init_(NULL), + basic_block_reg_arg_init_(NULL), basic_blocks_(code_item_->insns_size_in_code_units_), basic_block_landing_pads_(code_item_->tries_size_, NULL), basic_block_unwind_(NULL), basic_block_unreachable_(NULL), @@ -148,9 +148,6 @@ void MethodCompiler::EmitPrologue() { basic_block_shadow_frame_alloca_ = llvm::BasicBlock::Create(*context_, "prologue.shadowframe", func_); - basic_block_reg_zero_init_ = - llvm::BasicBlock::Create(*context_, "prologue.zeroinit", func_); - basic_block_reg_arg_init_ = llvm::BasicBlock::Create(*context_, "prologue.arginit", func_); @@ -235,9 +232,6 @@ void MethodCompiler::EmitPrologueLastBranch() { irb_.CreateBr(basic_block_shadow_frame_alloca_); irb_.SetInsertPoint(basic_block_shadow_frame_alloca_); - irb_.CreateBr(basic_block_reg_zero_init_); - - irb_.SetInsertPoint(basic_block_reg_zero_init_); irb_.CreateBr(basic_block_reg_arg_init_); } @@ -3926,18 +3920,12 @@ llvm::Value* MethodCompiler::AllocDalvikLocalVarReg(RegCategory cat, irb_.SetInsertPoint(basic_block_reg_alloca_); reg_addr = irb_.CreateAlloca(irb_.getJIntTy(), 0, StringPrintf("r%u", reg_idx)); - - irb_.SetInsertPoint(basic_block_reg_zero_init_); - irb_.CreateStore(irb_.getJInt(0), reg_addr); break; case kRegCat2: irb_.SetInsertPoint(basic_block_reg_alloca_); reg_addr = irb_.CreateAlloca(irb_.getJLongTy(), 0, StringPrintf("w%u", reg_idx)); - - irb_.SetInsertPoint(basic_block_reg_zero_init_); - irb_.CreateStore(irb_.getJLong(0), reg_addr); break; case kRegObject: @@ -3952,9 +3940,6 @@ llvm::Value* MethodCompiler::AllocDalvikLocalVarReg(RegCategory cat, reg_addr = irb_.CreateGEP(shadow_frame_, gep_index, StringPrintf("p%u", reg_idx)); - - irb_.SetInsertPoint(basic_block_reg_zero_init_); - irb_.CreateStore(irb_.getJNull(), reg_addr); } break; |