diff options
author | 2015-06-19 12:58:22 +0100 | |
---|---|---|
committer | 2015-06-19 15:01:42 +0100 | |
commit | f11c420c448baffac6a70ac0884d481ab347e257 (patch) | |
tree | dc7c7c03810c21351d2411e5c01bc0be8299ddd6 /compiler/dex/global_value_numbering.h | |
parent | d8d7b90ca57e8e3762951bb419b6f2645bb414c5 (diff) |
Quick: Fix optimizations for empty if blocks.
If a block ending with if-eqz or if-nez has the same "taken"
and "fallthrough", we cannot assume that the value has been
checked against zero in one of the succesors. This affects
the null check elimination pass as well as GVN. Refactor all
those checks to a single function in BasicBlock and check
that the "taken" and "falthrough" are different when needed.
Bug: 21614284
Change-Id: I8c6ac23e96cdaf5984786a555ebbd28110f095cb
Diffstat (limited to 'compiler/dex/global_value_numbering.h')
-rw-r--r-- | compiler/dex/global_value_numbering.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/dex/global_value_numbering.h b/compiler/dex/global_value_numbering.h index bd2f187d17..c514f75dcc 100644 --- a/compiler/dex/global_value_numbering.h +++ b/compiler/dex/global_value_numbering.h @@ -194,7 +194,9 @@ class GlobalValueNumbering : public DeletableArenaObject<kArenaAllocMisc> { return mir_graph_->GetBasicBlock(bb_id); } - static bool HasNullCheckLastInsn(const BasicBlock* pred_bb, BasicBlockId succ_id); + static bool HasNullCheckLastInsn(const BasicBlock* pred_bb, BasicBlockId succ_id) { + return pred_bb->BranchesToSuccessorOnlyIfNotZero(succ_id); + } bool NullCheckedInAllPredecessors(const ScopedArenaVector<uint16_t>& merge_names) const; |