OSDN Git Service

ART: Add div-zero check elimination to LVN/GVN
authorRazvan A Lupusoru <razvan.a.lupusoru@intel.com>
Fri, 14 Nov 2014 22:36:55 +0000 (14:36 -0800)
committerRazvan A Lupusoru <razvan.a.lupusoru@intel.com>
Sat, 22 Nov 2014 00:57:31 +0000 (00:57 +0000)
commite0951144d71a4791a5319ec507d84fce373018e0
tree5b065aac7c7fc419f65a74b8234908e972462f02
parentda4b7e8979e9b7de634aecee62da6ce867ccaa8d
ART: Add div-zero check elimination to LVN/GVN

GVN has been updated to also consider div/rem zero check elimination.
This means that whenever a divisor is used in two sequential divisions,
the second division will surely not throw exception.

The algorithm has been updated to work on global level by considering
splits and merges. Obviously, if "div_zero" checked on one path but
not the other, at merge point consider that division has not been
eliminated.

One big deficiency of this algorithm is that it does not consider
literals in the divisor. Namely, in cases where the operand is a literal
or a constant (literal created by another bytecode), it does not mark as
divide by zero checked. However, in reality this is not an issue
because none of the backends generate the divide by zero check when
the constant value is known.

Issue: CAR-868
Category: device enablement
Domain: AOSP.ART-ME
Origin: internal
Upstream-Candidate: yes
Change-Id: I617569055c73a45e13e2a83392b99b48f4e33362
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
compiler/dex/global_value_numbering.cc
compiler/dex/global_value_numbering.h
compiler/dex/global_value_numbering_test.cc
compiler/dex/local_value_numbering.cc
compiler/dex/local_value_numbering.h
compiler/dex/local_value_numbering_test.cc
compiler/dex/mir_graph.cc