diff options
| author | 2014-07-11 14:44:36 +0100 | |
|---|---|---|
| committer | 2014-07-22 19:38:24 +0100 | |
| commit | 0a810d2eab27cd097ebd09a44f0ce83aa608285b (patch) | |
| tree | 4fae42ff559b4c5381158fad3a6fe802dd8e904b /compiler/dex/mir_optimization.cc | |
| parent | e10a0bd05b195f71cc0ff2d59568d02d29939927 (diff) | |
Fix null pointer check elimination for catch entries.
Remove the special treatment of catch blocks for null
pointer check elimination and class initialization check
elimination. In both cases this can help optimizing
previously missed cases. In the null check case, this
avoids incorrect optimization as exposed by the new test.
Bug: 16230771
Change-Id: I834b7a1835d9ca8572f4f8d8516d93913c701ad1
Diffstat (limited to 'compiler/dex/mir_optimization.cc')
| -rw-r--r-- | compiler/dex/mir_optimization.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 869c48f66c..f69eea7fb0 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -737,11 +737,9 @@ bool MIRGraph::EliminateNullChecksAndInferTypes(BasicBlock* bb) { ArenaBitVector* ssa_regs_to_check = temp_bit_vector_; if (do_nce) { /* - * Set initial state. Be conservative with catch - * blocks and start with no assumptions about null check - * status (except for "this"). + * Set initial state. Catch blocks don't need any special treatment. */ - if ((bb->block_type == kEntryBlock) | bb->catch_entry) { + if (bb->block_type == kEntryBlock) { ssa_regs_to_check->ClearAllBits(); // Assume all ins are objects. for (uint16_t in_reg = cu_->num_dalvik_registers - cu_->num_ins; @@ -1047,12 +1045,11 @@ bool MIRGraph::EliminateClassInitChecks(BasicBlock* bb) { } /* - * Set initial state. Be conservative with catch - * blocks and start with no assumptions about class init check status. + * Set initial state. Catch blocks don't need any special treatment. */ ArenaBitVector* classes_to_check = temp_bit_vector_; DCHECK(classes_to_check != nullptr); - if ((bb->block_type == kEntryBlock) | bb->catch_entry) { + if (bb->block_type == kEntryBlock) { classes_to_check->SetInitialBits(temp_bit_vector_size_); } else if (bb->predecessors->Size() == 1) { BasicBlock* pred_bb = GetBasicBlock(bb->predecessors->Get(0)); |