History log of /art/compiler/dex/global_value_numbering.h
Revision Date Author Comments
9f7687cb5c1390ec4bcc2f8fa10dbee33aff3d6a 19-Jun-2015 Vladimir Marko <vmarko@google.com> 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

(cherry picked from commit f11c420c448baffac6a70ac0884d481ab347e257)

Change-Id: I062e0042de3470ce8680b586487b9c7acbd206bc
22fe45de11ed7afdf21400d2de3abd23f3a62800 18-Mar-2015 Vladimir Marko <vmarko@google.com> Quick: Eliminate check-cast guaranteed by instance-of.

Eliminate check-cast if the result of an instance-of with
the very same type on the same value is used to branch to
the check-cast's block or a dominator of it.

Note that there already exists a verifier-based elimination
of check-cast but it excludes check-cast on interfaces. This
new optimization works for interface types and, since it's
GVN-based, it can better recognize when the same reference
is used for instance-of and check-cast.

Change-Id: Ib315199805099d1cb0534bb4a90dc51baa409685
b666f4805c8ae707ea6fd7f6c7f375e0b000dba8 18-Feb-2015 Mathieu Chartier <mathieuc@google.com> Move arenas into runtime

Moved arena pool into the runtime.

Motivation:
Allow GC to use arena allocators, recycle arena pool for linear alloc.

Bug: 19264997
Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
7a01dc2107d4255b445c32867d15d45fcebb3acd 02-Jan-2015 Vladimir Marko <vmarko@google.com> Dead code elimination based on GVN results.

Change-Id: I5b77411a8f088f0b561da14b123cf6b0501c9db5
e4fcc5ba2284c201c022b52d27f7a1201d696324 13-Feb-2015 Vladimir Marko <vmarko@google.com> Clean up Scoped-/ArenaAlocator array allocations.

Change-Id: Id718f8a4450adf1608306286fa4e6b9194022532
0b9203e7996ee1856f620f95d95d8a273c43a3df 23-Jan-2015 Andreas Gampe <agampe@google.com> ART: Some Quick cleanup

Make several fields const in CompilationUnit. May benefit some Mir2Lir
code that repeats tests, and in general immutability is good.

Remove compiler_internals.h and refactor some other headers to reduce
overly broad imports (and thus forced recompiles on changes).

Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
e0951144d71a4791a5319ec507d84fce373018e0 14-Nov-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> 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>
af6925b7fe5dc5a3c8d52ee3370e86e75400f873 31-Oct-2014 Vladimir Marko <vmarko@google.com> Rewrite GVN's field id and field type handling.

Create a helper unit for dex insn classification and cache
dex field type (as encoded in the insn) in the MirFieldInfo.
Use this for cleanup and a few additional DCHECKs.

Change the GVN's field id to match the field lowering info
index (MIR::meta::{i,s}field_lowering_info), except where
multiple indexes refer to the same field and we use the
lowest of the applicable indexes. Use the MirMethodInfo from
MIRGraph to retrieve field type for GVN using this index.
This slightly reduces GVN compilation time and prepares for
further compilation time improvements.

Change-Id: I1b1247cdb8e8b6897254e2180f3230f10159bed5
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
a4426cff8a81e6af05aa8cc44c162110ccf2d397 22-Oct-2014 Vladimir Marko <vmarko@google.com> Quick: Fix wide Phi detection in GVN, clean up INVOKEs.

The detection of a wide Phi has been incorrectly looking at
the current LVN's wide sreg value map but we only intersect
live values and thus very often lose the information. This
results in failure to identify identical values, i.e.
potential missed optimizations. It also caused the bloating
of the global value map with values we would not use.

Rewrite the wide Phi detection to use the first merged LVN's
notion of wide sreg. For this to work we also need to use
the method's shorty to mark wide arguments.

Also clean up INVOKEs' processing to avoid another source
of bloating the global value map.

Bug: 16398693
Change-Id: I76718af7d62a8c6883ef43e4f47058f7eaf479e1
415ac88a6471792a28cf2b457fe4ba9dc099396e 30-Sep-2014 Vladimir Marko <vmarko@google.com> Quick: In GVN, apply modifications early if outside loop.

To improve GVN performance, apply modifications to blocks
outside loops during the initial convergence phase. During
the post processing phase, apply modifications only to the
blocks belonging to loops.

Also clean up the check whether to run the LVN and add the
capability to limit the maximum number of nested loops we
allow the GVN to process.

Change-Id: Ie7f1254f91a442397c06a325d5d314d8f58e5012
c8ccf68b805c92674545f63e0341ba47e8d9701c 30-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix some -Wpedantic errors

Remove extra semicolons.

Dollar signs in C++ identifiers are an extension.

Named variadic macros are an extension.

Binary literals are a C++14 feature.

Enum re-declarations are not allowed.

Overflow.

Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
2d2365cdaa54583b47c18a6506ccd0fd723ab6d0 19-Aug-2014 Vladimir Marko <vmarko@google.com> Improve GVN performance when merging null-checked values.

And ignore the limit on maximum number of processed basic
blocks once the GVN has actually converged and we're just
applying optimizations.

Bug: 16398693
Change-Id: Ie5aa0386ea4e0e9ae2bbf13963e2424e1713b22f
07206af370746e6d7cf528e655b4854e7a865cfa 29-Jul-2014 Vladimir Marko <vmarko@google.com> Reduce time and memory usage of GVN.

Filter out dead sregs in GVN. Reclaim memory after each LVN
in the GVN modification phase.

Bug: 16398693

(cherry picked from commit b19955d3c8fbd9588f7e17299e559d02938154b6)

Change-Id: I33c7912258a768b4c99d787056979fbc3b023b3b
b19955d3c8fbd9588f7e17299e559d02938154b6 29-Jul-2014 Vladimir Marko <vmarko@google.com> Reduce time and memory usage of GVN.

Filter out dead sregs in GVN. Reclaim memory after each LVN
in the GVN modification phase.

Bug: 16398693
Change-Id: I8c88c3009663754e1b66c0ef3f62c3b93276e385
1fd4821f6b3ac57a44c2ce91025686da4641d197 10-Jul-2014 Vladimir Marko <vmarko@google.com> Rewrite topological sort order and improve GVN.

Rewrite the topological sort order to include a full loop
before the blocks that go after the loop. Add a new iterator
class LoopRepeatingTopologicalSortIterator that differs from
the RepeatingTopologicalSortIterator by repeating only loops
and repeating them early. It returns to the loop head if the
head needs recalculation when we reach the end of the loop.

In GVN, use the new loop-repeating topological sort iterator
and for a loop head merge only the preceding blocks' LVNs
if we're not currently recalculating this loop.

Also fix LocalValueNumbering::InPlaceIntersectMaps() which
was keeping only the last element of the intersection, avoid
some unnecessary processing during LVN merge and add some
missing braces to MIRGraph::InferTypeAndSize().

Bug: 16398693

(cherry picked from 55fff044d3a4f7196098e25bab1dad106d9b54a2)

Change-Id: Id7bcd99c8abed1b7500b9ef723313d4c5fc6f1e8
55fff044d3a4f7196098e25bab1dad106d9b54a2 10-Jul-2014 Vladimir Marko <vmarko@google.com> Rewrite topological sort order and improve GVN.

Rewrite the topological sort order to include a full loop
before the blocks that go after the loop. Add a new iterator
class LoopRepeatingTopologicalSortIterator that differs from
the RepeatingTopologicalSortIterator by repeating only loops
and repeating them early. It returns to the loop head if the
head needs recalculation when we reach the end of the loop.

In GVN, use the new loop-repeating topological sort iterator
and for a loop head merge only the preceding blocks' LVNs
if we're not currently recalculating this loop.

Also fix LocalValueNumbering::InPlaceIntersectMaps() which
was keeping only the last element of the intersection, avoid
some unnecessary processing during LVN merge and add some
missing braces to MIRGraph::InferTypeAndSize().

Bug: 16398693
Change-Id: I4e10d4acb626a5b8a28ec0de106a7b37f9cbca32
95a059793c4c194f026afc74c713cc295d75d91a 30-May-2014 Vladimir Marko <vmarko@google.com> Global Value Numbering.

Implement the Global Value Numbering for optimization
purposes. Use it for the null check and range check
elimination as the LVN used to do.

The order of evaluation of basic blocks needs improving as
we currently fail to recognize some obviously identical
values in methods with more than one loop. (There are three
disabled tests that check this. This is just a missed
optimization, not a correctness issue.)

Change-Id: I0d0ce16b2495b5a3b17ad1b2b32931cd69f5a25a