History log of /art/compiler/optimizing/ssa_builder.cc
Revision Date Author Comments
e6564f4efe74b2bb505a5810852141404b82a4a9 19-Mar-2018 David Sehr <sehr@google.com> Move some remaining dex utilities

There were several utilities related to building/walking/testing dex
files that were not in libdexfile. This change consolidates these.

(cherry picked from commit 312f3b2fd0094c028a7d243b116947a35a745806)

Bug: 22322814
Test: make -j 50 test-art-host
Merged-In: Id76e9179d03b8ec7d67f7e0f267121f54f0ec2e0
Change-Id: Id76e9179d03b8ec7d67f7e0f267121f54f0ec2e0
dbb9aef046301940d0b253c918a5c78b277330ba 23-Nov-2017 Nicolas Geoffray <ngeoffray@google.com> Log at places we fail to compile.

Useful when diagnosing some compiler issues / limitations.

Test: test.py

Change-Id: I8759d0e78b0682b300ddcadfe02793432cab2036
69d310e0317e2fce97bf8c9c133c5c2c0332e61d 09-Oct-2017 Vladimir Marko <vmarko@google.com> Use ScopedArenaAllocator for building HGraph.

Memory needed to compile the two most expensive methods for
aosp_angler-userdebug boot image:
BatteryStats.dumpCheckinLocked() : 21.1MiB -> 20.2MiB
BatteryStats.dumpLocked(): 42.0MiB -> 40.3MiB
This is because all the memory previously used by the graph
builder is reused by later passes.

And finish the "arena"->"allocator" renaming; make renamed
allocator pointers that are members of classes const when
appropriate (and make a few more members around them const).

Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 64312607
Change-Id: Ia50aafc80c05941ae5b96984ba4f31ed4c78255e
ca6fff898afcb62491458ae8bcd428bfb3043da1 03-Oct-2017 Vladimir Marko <vmarko@google.com> ART: Use ScopedArenaAllocator for pass-local data.

Passes using local ArenaAllocator were hiding their memory
usage from the allocation counting, making it difficult to
track down where memory was used. Using ScopedArenaAllocator
reveals the memory usage.

This changes the HGraph constructor which requires a lot of
changes in tests. Refactor these tests to limit the amount
of work needed the next time we change that constructor.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Build with kArenaAllocatorCountAllocations = true.
Bug: 64312607
Change-Id: I34939e4086b500d6e827ff3ef2211d1a421ac91a
d5d2f2ce627aa0f6920d7ae05197abd1a396e035 26-Sep-2017 Vladimir Marko <vmarko@google.com> ART: Introduce Uint8 compiler data type.

This CL adds all the necessary codegen for the Uint8 type
but does not add code transformations that use that code.
Vectorization codegens are modified to use Uint8 as the
packed type when appropriate. The side effects are now
disconnected from the instruction's type after the graph has
been built to allow changing HArrayGet/H*FieldGet/HVecLoad
to use a type different from the underlying field or array.

Note: HArrayGet for String.charAt() is modified to have
no side effects whatsoever; Strings are immutable.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Test: testrunner.py --target --optimizing on Nexus 6P
Test: Nexus 6P boots.
Bug: 23964345
Change-Id: If2dfffedcfb1f50db24570a1e9bd517b3f17bfd0
0ebe0d83138bba1996e9c8007969b5381d972b32 21-Sep-2017 Vladimir Marko <vmarko@google.com> ART: Introduce compiler data type.

Replace most uses of the runtime's Primitive in compiler
with a new class DataType. This prepares for introducing
new types, such as Uint8, that the runtime does not need
to know about.

Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 23964345
Change-Id: Iec2ad82454eec678fffcd8279a9746b90feb9b0c
8d6768d47b66a688d35399d524ad5a5450e9d9d4 14-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^6 "Hash-based dex cache type array."

Fixed ImageWriter to write class table also if it contains
only boot class loader classes. Added a regression test and
added extra checks for debug-build to verify that dex cache
types from app image are also in the class table. Removed
some unnecessary debug output.

Test: 158-app-image-class-table
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 0b66d6174bf1f6023f9d36dda8538490b79c2e9f.

Change-Id: I6a747904940c6ebc297f4946feef99dc0adf930c
0b66d6174bf1f6023f9d36dda8538490b79c2e9f 13-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^5 "Hash-based dex cache type array."

For app images, ImageWriter does not add boot image
classes to the app image class table even though it
keeps them in the dex caches. The reason for that is
unknown, the code looks OK.

Bug: 34839984
Bug: 30627598
Bug: 34659969

Also reverts "Improve debugging output for a crash."

This reverts commits
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab,
8dd56fcb3196f466ecaffd445397cb11ef85f89f.

Test: testrunner.py --host
Change-Id: Ic8db128207c07588c7f11563208ae1e85c8b0e84
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab 14-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^4 "Hash-based dex cache type array."

Added extra output to the abort message to collect more data
when we hit the crash. Added extra check when loading an app
image to verify that the class table isn't already broken.

Test: testrunner.py --host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5.

Change-Id: I9bb442a184c236dcb75b3e42a095f39cd6bee59d
5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5 14-Feb-2017 Mathieu Chartier <mathieuc@google.com> Revert^3 "Hash-based dex cache type array."

Assert failing for "earchbox:search":
F zygote64: class_linker.cc:4612] Check failed: handle_scope_iface.Get() != nullptr

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 85c0f2ac03417f5125bc2ff1dab8109859c67d5c.

Change-Id: I39846c20295af5875b0f945be7035c73ded23135
85c0f2ac03417f5125bc2ff1dab8109859c67d5c 02-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^2 "Hash-based dex cache type array."

The reason for the revert was fixed by
https://android-review.googlesource.com/332666 .
We now enable clearing dex cache types in test 155 from that
CL. Also avoid an unnecessary store in LookupResolvedTypes()
and prevent verifier from messing up the dex cache types.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit d16363a93053de0f32252c7897d839a46aff14ae.

Change-Id: Ie8603cfa772e78e648d005b0b6eae59062ae729d
90b936ddda63139ff46a6755c3b83ad6e4ab4ac5 31-Jan-2017 Andreas Gampe <agampe@google.com> ART: Refactor verify_object.h

Move the actual VerifyObject check into a new cc file, as we
commonly don't enable the check at all. This allows to cut the
-inl include from almost all current users.

This also exposes missing -inl includes. Also fix up some of our old
mess where .h defined functions require -inl.h defined functions.

Test: m

Change-Id: I3dd821bbe2015564a29bf1ed9be00f7a7276ad61
d16363a93053de0f32252c7897d839a46aff14ae 01-Feb-2017 Vladimir Marko <vmarko@google.com> Revert "Hash-based dex cache type array."

Reverting to work around some programs crashing with
Check failed: handle_scope_iface.Get() != nullptr.
though the reason for the failure not yet understood.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969
Bug: 30419309

This reverts commit ec7862283dd49f5a58d0ac45960ce27c2f7671b8.

Change-Id: Ifded663633082f1e59e5b6ff2e026dc559bd6b82
ec7862283dd49f5a58d0ac45960ce27c2f7671b8 20-Dec-2016 Vladimir Marko <vmarko@google.com> Hash-based dex cache type array.

Test: m test-art-host (Interpreter, Optimizing, JIT)
Test: m test-art-target on Nexus 6P (Interpreter, Optimizing, JIT)
Test: Nexus 6P boots
Test: m valgrind-test-art-host
Bug: 30627598
Bug: 34659969
Bug: 30419309
Change-Id: Ic00eda89e58088a3573fc9ec0ad04c0e69e161d1
2c45bc9137c29f886e69923535aff31a74d90829 25-Oct-2016 Vladimir Marko <vmarko@google.com> Remove H[Reverse]PostOrderIterator and HInsertionOrderIterator.

Use range-based loops instead, introducing helper functions
ReverseRange() for iteration in reverse order in containers.
When the contents of the underlying container change inside
the loop, use an index-based loop that better exposes the
container data modifications, compared to the old iterator
interface that's hiding it which may lead to subtle bugs.

Test: m test-art-host
Change-Id: I2a4e6c508b854c37a697fc4b1e8423a8c92c5ea0
50a9ed014e3b4dec67246ea07727d7bec89bfb17 23-Sep-2016 Nicolas Geoffray <ngeoffray@google.com> Compensate in compiler for verifier shortcomings.

The verifier does not differentiate zero and null, so a move-object
of zero can be used as a non-object later on.

Change the compiler to ignore the object conversion when the input
is zero or a phi (which might just hold zeros). The type propagation
will then do proper inferencing of the types.

Also remove some stalled comments in ssa_builder.cc.

bug:31313170
test: dex2oat b31313170.apk
test: run-test 800
test: m test-art-host-run-test
Change-Id: I579d667415a7decf8ff2c2238dae4c13eec5d0e0
bdf7f1c3ab65ccb70f62db5ab31dba060632d458 31-Aug-2016 Andreas Gampe <agampe@google.com> ART: SHARED_REQUIRES to REQUIRES_SHARED

This coincides with the actual attribute name and upstream usage.
Preparation for deferring to libbase.

Test: m
Test: m test-art-host
Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
e90049140fdfb89080e5cc9b000b0c9be8c18bcd 16-Jun-2016 Vladimir Marko <vmarko@google.com> Create a typedef for HInstruction::GetInputs() return type.

And some other cleanup after
https://android-review.googlesource.com/230742

Test: No new tests. ART test suite passed (tested on host).
Change-Id: I4743bf17544d0234c6ccb46dd0c1b9aae5c93e17
372f10e5b0b34e2bb6e2b79aeba6c441e14afd1f 17-May-2016 Vladimir Marko <vmarko@google.com> Refactor handling of input records.

Introduce HInstruction::GetInputRecords(), a new virtual
function that returns an ArrayRef<> to all input records.
Implement all other functions dealing with input records as
wrappers around GetInputRecords(). Rewrite functions that
previously used multiple virtual calls to deal with input
records, especially in loops, to prefetch the ArrayRef<>
only once for each instruction. Besides avoiding all the
extra calls, this also allows the compiler (clang++) to
perform additional optimizations.

This speeds up the Nexus 5 boot image compilation by ~0.5s
(4% of "Compile Dex File", 2% of dex2oat time) on AOSP ToT.

Change-Id: Id8ebe0fb9405e38d918972a11bd724146e4ca578
a26b3c51bfd97be1100d267f20c46535913e6bb7 09-May-2016 Vladimir Marko <vmarko@google.com> Attribute arena allocations previously marked as STL.

Bug: 28603175
Bug: 28684584

(cherry picked from commit 3ea5a97d27468cec846d958c38d0d706ef7ec67e)

Change-Id: I7f1bd22e7710cca74f4b10fd13cb8fa2c3b1b318
3ea5a97d27468cec846d958c38d0d706ef7ec67e 09-May-2016 Vladimir Marko <vmarko@google.com> Attribute arena allocations previously marked as STL.

Bug: 28603175
Change-Id: I488e39b23afb86f3ff5a2df16d2df59eb3adaa0f
a4336d253b88f95c49891a8084579a4599785e90 19-Apr-2016 Vladimir Marko <vmarko@google.com> Use dex cache from compilation unit in RTP.

Avoid calling the costly ClassLinker::FindDexCache() from
reference type propagation when the dex cache from the
compilation unit will do, i.e. almost always. Compiling
the Nexus 5 boot image on host under perf(1) shows that
the FindDexCache() hits drop from about 0.2% to almost
nothing, though enabling inlining for the boot image will
increase it a bit to 0.03% due to unavoidable calls from
the inliner.

Also clean up the ScopedObjectAccess usage a bit.

Bug: 28173563

Cherry-picked the "revert-revert"
(cherry picked from commit 456307a47336e3d6576ed6d8563b67573a4238d3)
and squashed two subsequent fixes
Fix RTP to hold mutator lock while using raw mirror pointers.
(cherry picked from commit 62977ff198deb673a6990202a2fb8b993217c57c)
Fix reference_type_propagation_test.
(cherry picked from commit 5eed0c5d27f091c952704f652cd77c4e3833ad88)

Change-Id: Ia944452d7ab26aed963832a9346df363743a419f
d59f3b1b7f5c1ab9f0731ff9dc60611e8d9a6ede 29-Mar-2016 Vladimir Marko <vmarko@google.com> Use iterators "before" the use node in HUserRecord<>.

Create a new template class IntrusiveForwardList<> that
mimicks std::forward_list<> except that all allocations
are handled externally. This is essentially the same as
boost::intrusive::slist<> but since we're not using Boost
we have to reinvent the wheel.

Use the new container to replace the HUseList and use the
iterators to "before" use nodes in HUserRecord<> to avoid
the extra pointer to the previous node which was used
exclusively for removing nodes from the list. This reduces
the size of the HUseListNode by 25%, 32B to 24B in 64-bit
compiler, 16B to 12B in 32-bit compiler. This translates
directly to overall memory savings for the 64-bit compiler
but due to rounding up of the arena allocations to 8B, we
do not get any improvement in the 32-bit compiler.

Compiling the Nexus 5 boot image with the 64-bit dex2oat
on host this CL reduces the memory used for compiling the
most hungry method, BatteryStats.dumpLocked(), by ~3.3MiB:

Before:
MEM: used: 47829200, allocated: 48769120, lost: 939920
Number of arenas allocated: 345,
Number of allocations: 815492, avg size: 58
...
UseListNode 13744640
...
After:
MEM: used: 44393040, allocated: 45361248, lost: 968208
Number of arenas allocated: 319,
Number of allocations: 815492, avg size: 54
...
UseListNode 10308480
...

Note that while we do not ship the 64-bit dex2oat to the
device, the JIT compilation for 64-bit processes is using
the 64-bit libart-compiler.

Bug: 28173563
Bug: 27856014

(cherry picked from commit 46817b876ab00d6b78905b80ed12b4344c522b6c)

Change-Id: Ifb2d7b357064b003244e92c0d601d81a05e56a7b
456307a47336e3d6576ed6d8563b67573a4238d3 19-Apr-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Use dex cache from compilation unit in RTP.""

The exposed issue has been fixed by
https://android-review.googlesource.com/215877

Bug:28210356

This reverts commit 34d9b04d8d0006967486c0ad1b221e7b632652af.

Change-Id: I5288c923e45d9ef3190dabb89738350a1212a60d
46817b876ab00d6b78905b80ed12b4344c522b6c 29-Mar-2016 Vladimir Marko <vmarko@google.com> Use iterators "before" the use node in HUserRecord<>.

Create a new template class IntrusiveForwardList<> that
mimicks std::forward_list<> except that all allocations
are handled externally. This is essentially the same as
boost::intrusive::slist<> but since we're not using Boost
we have to reinvent the wheel.

Use the new container to replace the HUseList and use the
iterators to "before" use nodes in HUserRecord<> to avoid
the extra pointer to the previous node which was used
exclusively for removing nodes from the list. This reduces
the size of the HUseListNode by 25%, 32B to 24B in 64-bit
compiler, 16B to 12B in 32-bit compiler. This translates
directly to overall memory savings for the 64-bit compiler
but due to rounding up of the arena allocations to 8B, we
do not get any improvement in the 32-bit compiler.

Compiling the Nexus 5 boot image with the 64-bit dex2oat
on host this CL reduces the memory used for compiling the
most hungry method, BatteryStats.dumpLocked(), by ~3.3MiB:

Before:
MEM: used: 47829200, allocated: 48769120, lost: 939920
Number of arenas allocated: 345,
Number of allocations: 815492, avg size: 58
...
UseListNode 13744640
...
After:
MEM: used: 44393040, allocated: 45361248, lost: 968208
Number of arenas allocated: 319,
Number of allocations: 815492, avg size: 54
...
UseListNode 10308480
...

Note that while we do not ship the 64-bit dex2oat to the
device, the JIT compilation for 64-bit processes is using
the 64-bit libart-compiler.

Bug: 28173563
Change-Id: I985eabd4816f845372d8aaa825a1489cf9569208
18b36abc7cc03076fe1c399c0bb8ec8793cc6806 14-Apr-2016 Aart Bik <ajcbik@google.com> Remove the no-longer-needed F/I and D/J alias.

Rationale:
Now that our HIR is type clean (yeah!), we no longer have
to conservatively assume F/I and D/J are aliased. This
enables more accurate side effects analysis, with improvements
in all clients, such a LICM.

Refinement:
The HIR is not completely clean between building and SSA.
This refinement takes care of that, with new tests.

BUG=22538329

Change-Id: Id78ff0ff4e325aeebf0022d868937cff73d3a742
34d9b04d8d0006967486c0ad1b221e7b632652af 15-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Use dex cache from compilation unit in RTP."

bug:28210356

This reverts commit 27bb86edf60e2f9ca2c1075c0c86b9e79374f1d0.

Change-Id: Ib27ee90a7e4d516fd2db67a9c4e454023737841a
27bb86edf60e2f9ca2c1075c0c86b9e79374f1d0 14-Apr-2016 Vladimir Marko <vmarko@google.com> Use dex cache from compilation unit in RTP.

Avoid calling the costly ClassLinker::FindDexCache() from
reference type propagation when the dex cache from the
compilation unit will do, i.e. almost always. Compiling
the Nexus 5 boot image on host under perf(1) shows that
the FindDexCache() hits drop from about 0.2% to almost
nothing, though enabling inlining for the boot image will
increase it a bit to 0.03% due to unavoidable calls from
the inliner.

Also clean up the ScopedObjectAccess usage a bit.

Change-Id: I426a5f9f5da9e64fad2ea57654240789a48d3871
dee58d6bb6d567fcd0c4f39d8d690c3acaf0e432 07-Apr-2016 David Brazdil <dbrazdil@google.com> Revert "Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals""

This patch merges the instruction-building phases from HGraphBuilder
and SsaBuilder into a single HInstructionBuilder class. As a result,
it is not necessary to generate HLocal, HLoadLocal and HStoreLocal
instructions any more, as the builder produces SSA form directly.

Saves 5-15% of arena-allocated memory (see bug for more data):
GMS 20.46MB => 19.26MB (-5.86%)
Maps 24.12MB => 21.47MB (-10.98%)
YouTube 28.60MB => 26.01MB (-9.05%)

This CL fixed an issue with parsing quickened instructions.

Bug: 27894376
Bug: 27998571
Bug: 27995065

Change-Id: I20dbe1bf2d0fe296377478db98cb86cba695e694
60328910cad396589474f8513391ba733d19390b 04-Apr-2016 David Brazdil <dbrazdil@google.com> Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals"

Bug: 27995065
This reverts commit e3ff7b293be2a6791fe9d135d660c0cffe4bd73f.

Change-Id: I5363c7ce18f47fd422c15eed5423a345a57249d8
e3ff7b293be2a6791fe9d135d660c0cffe4bd73f 02-Mar-2016 David Brazdil <dbrazdil@google.com> Refactor HGraphBuilder and SsaBuilder to remove HLocals

This patch merges the instruction-building phases from HGraphBuilder
and SsaBuilder into a single HInstructionBuilder class. As a result,
it is not necessary to generate HLocal, HLoadLocal and HStoreLocal
instructions any more, as the builder produces SSA form directly.

Saves 5-15% of arena-allocated memory (see bug for more data):
GMS 20.46MB => 19.26MB (-5.86%)
Maps 24.12MB => 21.47MB (-10.98%)
YouTube 28.60MB => 26.01MB (-9.05%)

Bug: 27894376
Change-Id: Iefe28d40600c169c5d306fd2c77034ae19476d90
86ea7eeabe30c98bbe1651a51d03cb89776724e7 16-Feb-2016 David Brazdil <dbrazdil@google.com> Build dominator tree before generating HInstructions

Second CL in the series of merging HGraphBuilder and SsaBuilder. This
patch refactors the builders so that dominator tree can be built
before any HInstructions are generated. This puts the SsaBuilder
removal of HLoadLocals/HStoreLocals straight after HGraphBuilder's
HInstruction generation phase. Next CL will therefore be able to
merge them.

This patch also adds util classes for iterating bytecode and switch
tables which allowed to simplify the code.

Bug: 27894376
Change-Id: Ic425d298b2e6e7980481ed697230b1a0b7904526
eda3140656dafa03dc7fd4b3f90246a8522f0c1b 24-Mar-2016 Aart Bik <ajcbik@google.com> Avoid removing new-instance instruction twice.
Includes a fail-before/pass-after regression test.

Rationale:
In some corner cases, one new instance reached more than one
java.lang.String.<init> method call. As a result, the new
instance instruction appeared multiple times in the vector
uninitialized_strings_. A second removal crashes the compiler.
This change list avoid the crash by simply skipping instructions
that are already removed.

BUG=27847265

Change-Id: I7f8a4f84ea3c184e1529ec3e90bd6749c83c445b
98e6ce44c700abd9375fe17f0aa31fea1e1e938b 16-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Remove string init map.

Partial revert of the String init change.

- Make Quick bailout in the presence of String allocation.
- Rely on the compiler for knowing when dex registers alias.

bug:27173201

Change-Id: I0bf58ba3825c71cef110b53f3a0a6f567cb2ef9a
5e08e3643230ff89f3d7e9b5d7660db6fd94bec9 15-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Expect less in the presence of a string init call.

The compiler currently relies on the dex cache being populated
for doing proper type propagation. If it hasn't, we may end up in the
situation where the DexMethodInliner has recognized a String.<init> call
(because DexMethodInliner only looks at signatures, and does not resolve
types), but the graph builder doesn't see a type and assume it needs
to do access checks and clinit checks on it.

Change-Id: Id79313b0610b127909e3e057305b6632b0b172f7
badd826664896d4a9628a5a89b78016894aa414b 02-Feb-2016 David Brazdil <dbrazdil@google.com> ART: Run SsaBuilder from HGraphBuilder

First step towards merging the two passes, which will later result in
HGraphBuilder directly producing SSA form. This CL mostly just updates
tests broken by not being able to inspect the pre-SSA form.

Using HLocals outside the HGraphBuilder is now deprecated.

Bug: 27150508
Change-Id: I00fb6050580f409dcc5aa5b5aa3a536d6e8d759e
6e332529c33be4d7dae5dad3609a839f4c0d3bfc 02-Feb-2016 David Brazdil <dbrazdil@google.com> ART: Remove HTemporary

Change-Id: I21b984224370a9ce7a4a13a9652503cfb03c5f03
d9994f069dfeaa32ba929ca78816b5b83e2a4134 11-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Re-enable OSR.

Fixes two bugs:
- Dealing with proxy methods, which the compiler and code cache
does not handle.
- Dealing with phi types, that may have been speculatively optimized
but do not hold once jumping to the compiled code.

Change-Id: I7dcd9976ef7b12128fff95d2b7ed3e69cc42e90a
c047d94f02334b419ce532c3bf7da3e91e69dae1 20-Jan-2016 David Brazdil <dbrazdil@google.com> ART: DCHECK still too strong for String NewInstance

Even though the presence of a irreducible loop phi is the reason why
String.<init> may see its first input not being the NewInstance, it
may see a different phi from the same cycle. We have to relax the
corresponding DCHECK.

Bug: 26676472
Change-Id: Iba6fffa74833c57aad8aa07dc382ff6b93838de1
bc9ab1630a198efbbf730275541291321ac3d2d4 20-Jan-2016 David Brazdil <dbrazdil@google.com> ART: Cannot assume String.<init> called on NewInstance

Irreducible loops create uneliminatable phis for all live vregs. This
breaks the StringFactory optimization which assumes that the first
input is always a NewInstance instruction.

Bug: 26676472

Change-Id: Ib7dfdadbafbbfef89e1f5b1a80eb75ecf792621a
65902e86b91f984061657bd8cacf239edb53c39d 15-Jan-2016 David Brazdil <dbrazdil@google.com> ART: Optimize out redundant NewInstances of String

NewInstance of String creates an empty String object before it is
replaced by the result of a StringFactory call (String.<init>). If
the empty object is never used prior to the call, it can be safely
removed (replaced with null in this case).

We do not remove the instruction if:
- it has a real use (comparison, instanceof, check-cast), or
- we are compiling with --debuggable and there is an environment use.

If removed and execution deoptimizes before the StringFactory call,
the interpreter will see String.<init> being called on a null object.
Since the verifier guarantees that the call was made on new-instance
in the input bytecode (b/26579108), the interpreter can safely assume
that it was optimized out rather than throw NullPointerException.

Results (all without --debuggable):
- boot.oat: 563/563 removed
- Google Maps: 480/480 removed
- Google Docs: 819/819 removed

Change-Id: I9fdfc50e9dea6299a7327f94327cdfd2b2538079
6de1938e562b0d06e462512dd806166e754035ea 08-Jan-2016 David Brazdil <dbrazdil@google.com> ART: Remove incorrect HFakeString optimization

Simplification of HFakeString assumes that it cannot be used until
String.<init> is called which is not true and causes different
behaviour between the compiler and the interpreter. This patch
removes the optimization together with the HFakeString instruction.

Instead, HNewInstance is generated and an empty String allocated
until it is replaced with the result of the StringFactory call. This
is consistent with the behaviour of the interpreter but is too
conservative. A follow-up CL will attempt to optimize out the initial
allocation when possible.

Bug: 26457745
Bug: 26486014

Change-Id: I7139e37ed00a880715bfc234896a930fde670c44
15bd22849ee6a1ffb3fb3630f686c2870bdf1bbc 05-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Implement irreducible loop support in optimizing.

So we don't fallback to the interpreter in the presence of
irreducible loops.

Implications:
- A loop pre-header does not necessarily dominate a loop header.
- Non-constant redundant phis will be kept in loop headers, to
satisfy our linear scan register allocation algorithm.
- while-graph optimizations, such as gvn, licm, lse, and dce
need to know when they are dealing with irreducible loops.

Change-Id: I2cea8934ce0b40162d215353497c7f77d6c9137e
15693bfdf9fa3ec79327a77b7e10315614d716cc 16-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Resolve ambiguous ArraySets

Just like aget(-wide), the value operand of aput(-wide) bytecode
instructions can be both int/long and float/double. This patch builds
on the previous mechanism for resolving type of ArrayGets to type the
values of ArraySets based on the reference type of the array.

Bug: 22538329

Change-Id: Ic86abbb58de146692de04476b555010b6fcdd8b6
d87f3eaa80139564969433fd47c0f6abf8dc46ba 04-Jan-2016 David Brazdil <dbrazdil@google.com> ART: Use Primitive::Is64BitType in SsaBuilder::TypePhiFromInputs

Accidentally submitted CL Ib39f3da2b92bc5be5d76f4240a77567d82c6bebe
without this.

Bug: 26208284
Change-Id: I2e69ca2fde72171f2ce645304c4835d8d57f4e0b
4833f5a1990c76bc2be89504225fb13cca22bedf 16-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Refactor SsaBuilder for more precise typing info

This reverts commit 68289a531484d26214e09f1eadd9833531a3bc3c.

Now uses Primitive::Is64BitType instead of Primitive::ComponentSize
because it was incorrectly optimized by GCC.

Bug: 26208284
Bug: 24252151
Bug: 24252100
Bug: 22538329
Bug: 25786318

Change-Id: Ib39f3da2b92bc5be5d76f4240a77567d82c6bebe
68289a531484d26214e09f1eadd9833531a3bc3c 16-Dec-2015 Alex Light <allight@google.com> Revert "ART: Refactor SsaBuilder for more precise typing info"

This reverts commit d9510dfc32349eeb4f2145c801f7ba1d5bccfb12.

Bug: 26208284

Bug: 24252151
Bug: 24252100
Bug: 22538329
Bug: 25786318

Change-Id: I5f491becdf076ff51d437d490405ec4e1586c010
d9510dfc32349eeb4f2145c801f7ba1d5bccfb12 05-Nov-2015 David Brazdil <dbrazdil@google.com> ART: Refactor SsaBuilder for more precise typing info

This patch refactors the SsaBuilder to do the following:

1) All phis are constructed live and marked dead if not used or proved
to be conflicting.

2) Primitive type propagation, now not a separate pass, identifies
conflicting types and marks corresponding phis dead.

3) When compiling --debuggable, DeadPhiHandling used to revive phis
which had only environmental uses but did not attempt to resolve
conflicts. This pass was removed as obsolete and is now superseded
by primitive type propagation (identifying conflicting phis) and
SsaDeadPhiEliminiation (keeping phis live if debuggable + env use).

4) Resolving conflicts requires correct primitive type information
on all instructions. This was not the case for ArrayGet instructions
which can have ambiguous types in the bytecode. To this end,
SsaBuilder now runs reference type propagation and types ArrayGets
from the type of the input array.

5) With RTP being run inside the SsaBuilder, it is not necessary to
run it as a separate optimization pass. Optimizations can now assume
that all instructions of type kPrimNot have reference type info after
SsaBuilder (with the exception of NullConstant).

6) Graph now contains a reference type to be assigned to NullConstant.
All reference type instructions therefore have RTI, as now enforced
by the SsaChecker.

Bug: 24252151
Bug: 24252100
Bug: 22538329
Bug: 25786318

Change-Id: I7a3aee1ff66c82d64b4846611c547af17e91d260
809d70f5b268227dbd59432dc038c74d8351be29 19-Nov-2015 David Brazdil <dbrazdil@google.com> ART: Fix wide stores in Optimizing

SsaBuilder::VisitStoreLocal did not take into account the following:
(a) when storing a wide value, the high vreg must be invalidated,
(b) when storing into the high vreg of a wide value, the low vreg
must be invalidated.

Both situations cause overestimation of liveness but only (b) has
implications on correctness. CodeGenerator::EmitEnvironment will skip
the high vreg, causing deoptimizing and try/catch to load a wrong
value for that vreg.

In order to fix this bug, several changes had to be made to the
SsaBuilder:
(1) phis need to be initialized with a type which matches its
inputs' size,
(2) eagerly created loop header phis may end up being undefined
because of their corresponding vregs being invalidated inside
the loop; these are marked dead during input setting,
(3) the entire SSA-building algorithm should never revive an
undefined loop header phi.

Bug: 25677992
Bug: https://code.google.com/p/android/issues/detail?id=194022

Change-Id: Id8a852e38c3f5ff1c2e608b1aafd6d5ac8311e32
d26a411adee1e71b3f09dd604ab9b23018037138 10-Nov-2015 David Brazdil <dbrazdil@google.com> ART: Refactor iteration over normal/exceptional successors

Add helper methods on HBasicBlock which return ArrayRef with the
suitable sub-array of the `successors_` list.

Change-Id: I66c83bb56f2984d7550bf77c48110af4087515a8
2bd4c5c1b704be8a81d9b7a94b3e828afa2b0963 04-Nov-2015 David Brazdil <dbrazdil@google.com> Revert "ART: Implement DeadPhiHandling in PrimitiveTypePropagation"

Crashes on YouTube, need to investigate

This reverts commit 1749e2cfb5c5ed4d6970a09aecf898ca9cdfcb75.

Change-Id: If5f133d55dcc26b8db79a670a48fbd4af7807556
1749e2cfb5c5ed4d6970a09aecf898ca9cdfcb75 28-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Implement DeadPhiHandling in PrimitiveTypePropagation

DeadPhiHandling revives non-conflicting phis with environment uses
but does not properly merge types. To not duplicate code, this patch
modifies PrimitiveTypePropagation to deal with conflicts and thus
replaces DeadPhiHandling altogether.

Bug: 24252151
Bug: 24252100

Change-Id: I198c71d1b8167fc05783a5a24aa9f1e3804acafe
ec7802a102d49ab5c17495118d4fe0bcc7287beb 01-Oct-2015 Vladimir Marko <vmarko@google.com> Add DCHECKs to ArenaVector and ScopedArenaVector.

Implement dchecked_vector<> template that DCHECK()s element
access and insert()/emplace()/erase() positions. Change the
ArenaVector<> and ScopedArenaVector<> aliases to use the new
template instead of std::vector<>. Remove DCHECK()s that
have now become unnecessary from the Optimizing compiler.

Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
b11fc61d9769753ec9e4a51b88ee288923159283 29-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in DeadPhiHandling around conflicting phis.

Change-Id: I44ec40f71a7e05eb4295bea55f6045cb86017329
1d0a03c2eb0e26ded029b84e011458e8466f87de 28-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Fix DeadPhiHandling creating >2 equivalents

Run test 531 failed a DCHECK because the DeadPhiHandling algorithm
would generate three phis of the same type:
(0) loop phi [#0, ref] with equivalents void & object
(1) type object equivalent by its first input => int & int
(2) request object equivalent by a user => int & int & object
(3) type second => int & object & object (dead)
(4) type first => object & object & object

This patch fixes the issue by skipping (1) when the phi already has
a type, thus not creating the third equivalent for the phi's user.

Change-Id: I00c990a5982ddc1f7de013f72bbcfb1c649a6e5f
d0180f9027488b95a47b35efa9ced30aeb86ff06 22-Sep-2015 David Brazdil <dbrazdil@google.com> ART: SsaBuilder clean up

Adds DCHECKs which verify assumptions about catch blocks. Uses HPhi::
IsVRegEquivalentOf instead of a local function.

Change-Id: I1b6db5ff2da5263d61261963308b6d65453a6d56
b701315cb7c4dfe907c27c24c819b7a14141fd2e 17-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Fix bug in DeadPhiHandling

When reviving dead phis for --debuggable, the DeadPhiHandling algorithm
could produce two phis of the same type, which causes the SSAChecker
graph verifier to fail. This patch fixes the bug.

Note that the code is currently not exercised because compilation is
delegated to Quick for --debuggable.

Bug: 24129675
Change-Id: I26b6dcf3071b325cc7871b989a36c505279ae681
eead0711984ee20a3bba7c2e2415593a520e40b3 18-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Optimize catch phi creation to save memory.

Catch phis are eagerly created for all vregs and then removed as
throwing instructions with undefined locals are encountered. This can
be optimized since rougly one third of vregs is already undefined with
the first throwing instruction.

Change-Id: Ia4e66f19ea03f9a129b4b64d4193d262fff45224
3eaa32f72b6abd807964134aad4c158946dc92e3 18-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Delete catch phis for undefined vregs.

SSA builder assumed that (eagerly created) catch phis for undefined
vregs must be dead and will be deleted by dead phi elimination. This,
however, does not hold for --debuggable because the catch phis might
be revived for their environment uses. This patch modifies the builder
to delete the phis itself.

Bug: 24054676
Change-Id: Iaa5f2487ff1c38353b44cb89c709bbff1ecd73cc
71bf8090663d02869cafafdd530976f7f2a9db7f 15-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag arena allocations in SsaBuilder.

Replace GrowableArray with ArenaVector in SsaBuilder and
tag allocations with a new arena allocation type.

Change-Id: I27312c51d7be9d2ad02a974cce93b365c65c5fc4
6058455d486219994921b63a2d774dc9908415a2 03-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag basic block allocations with their source.

Replace GrowableArray with ArenaVector in HBasicBlock and,
to track the source of allocations, assign one new and two
Quick's arena allocation types to these vectors. Rename
kArenaAllocSuccessor to kArenaAllocSuccessors.

Bug: 23736311
Change-Id: Ib52e51698890675bde61f007fe6039338cf1a025
145acc5361deb769eed998f057bc23abaef6e116 03-Sep-2015 Vladimir Marko <vmarko@google.com> Revert "Optimizing: Tag basic block allocations with their source."

Reverting so that we can have more discussion about the STL API.

This reverts commit 91e11c0c840193c6822e66846020b6647de243d5.

Change-Id: I187fe52f2c16b6e7c5c9d49c42921eb6c7063dba
91e11c0c840193c6822e66846020b6647de243d5 02-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag basic block allocations with their source.

Replace GrowableArray with ArenaVector in HBasicBlock and,
to track the source of allocations, assign one new and two
Quick's arena allocation types to these vectors. Rename
kArenaAllocSuccessor to kArenaAllocSuccessors.

Bug: 23736311
Change-Id: I984aef6e615ae2380a532f5c6726af21015f43f5
ec16f79a4d0aeff319bf52139a0c82de3080d73c 19-Aug-2015 David Brazdil <dbrazdil@google.com> ART: Refactor try/catch block info, store exception type

This patch replaces HBasicBlock fields storing try/catch info with a
single TryCatchInformation data structure, saving memory for the
majority of non-try/catch blocks. It also changes builder to store
the exception type for catch blocks.

Change-Id: Ib3e43f7db247e6915d67c267fc62410420e230c9
29fc008c9689e9036a3f5e3bd186bbfb5de3cb82 18-Aug-2015 David Brazdil <dbrazdil@google.com> ART: Revert storing of exceptional predecessors

After change of the approach for try/catch register allocation, it is
no longer necessary to record instructions which might throw into a
catch block.

Change-Id: I7ef12ed06c49a35280029810975fa2a50fe4a424
b618adebbc19e50d7b1aa2f11b84341beb3c64dc 29-Jul-2015 David Brazdil <dbrazdil@google.com> ART: Store and check exceptional predecessors

Future CL on register allocation for try/catch will require the
knowledge of instructions which throw into a catch block. This patch
stores that information with the basic block and verifies it in the
graph checker.

More checks on try catch also added to the graph checker and an order
of exception handlers is enforced in TryBoundary successors.

Change-Id: I3034c610791ea51d96724bcca97f49ec6ecf2af3
ffee3d33f3ea39aa6031c3d2ff29c4806c8dcc51 06-Jul-2015 David Brazdil <dbrazdil@google.com> ART: Build SSA form when try/catch is present

This patch implements support for try/catch in the SsaBuilder.
Values of locals are propagated from throwing sites inside try
blocks to their respective catch blocks and phis ("catch phis")
are created when necessary.

Change-Id: I0736565c2c4ff3f9f0924b6e3a785a50023f875a
fecc4659d0a4ac1e0e16e82b47e5592fff1d827f 29-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Do not replace a live phi with a dead phi.

A dead phi is not properly typed. Therefore, always use the live phi
equivalent instead.

bug:21865466

(cherry picked from commit 4230e1895b915a22363452823b0e51eabe92cb60)

Change-Id: If9a3313fc953c2eb4be85b625676e48112fcb1f6
4230e1895b915a22363452823b0e51eabe92cb60 29-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Do not replace a live phi with a dead phi.

A dead phi is not properly typed. Therefore, always use the live phi
equivalent instead.

bug:21865466
Change-Id: Id5e26ae4062cc18f5532d5b95cc024480652d5b2
23fad477d90b826956158aac41d70461c2c7a3ed 15-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Fix reference comparison after redundant phi elimination.

Otherwise, the graph could remain mistyped.

bug:21776173

(cherry picked from commit 51d400d4ebd41b9fb4d67ac3179f8fb66a090fdd)

Change-Id: Iff36dfa4e79b14a9dd85c37e0fbb9e1080dd0364
51d400d4ebd41b9fb4d67ac3179f8fb66a090fdd 15-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Fix reference comparison after redundant phi elimination.

Otherwise, the graph could remain mistyped.

bug:21776173

Change-Id: I491f4b95e1763cbd1ade777da0a23bae319fed63
d23eeef3492b53102eb8093524cf37e2b4c296db 18-May-2015 Nicolas Geoffray <ngeoffray@google.com> Support for inlining methods that call/throw.

Mostly fixes here and there to make it working.

Change-Id: I1b535e895105d78b65634636d675b818551f783e
b176d7c6c8c01a50317f837a78de5da57ee84fb2 20-May-2015 Nicolas Geoffray <ngeoffray@google.com> Also encode the InvokeType in an InlineInfo.

This will be needed to recover the call stack.

Change-Id: I2fe10785eb1167939c8cce1862b2d7f4066e16ec
8909bafa5d64e12eb53f3d37b984f53e7a632224 23-Apr-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Mark CheckCast's and InstanceOf's input as !CanBeNull if used before in a NullCheck

Change-Id: Ied0412a01922b40a3f5d89bed49707498582abc1
0a23d74dc2751440822960eab218be4cb8843647 07-May-2015 Nicolas Geoffray <ngeoffray@google.com> Add a parent environment to HEnvironment.

This code has no functionality change. It adds a placeholder
for chaining inlined frames.

Change-Id: I5ec57335af76ee406052345b947aad98a6a4423a
8c0c91a845568624815df026cfdac8c42ecccdf6 07-May-2015 Nicolas Geoffray <ngeoffray@google.com> Use a growable array instead of an environment during SSA.

Using an environment was convenient because it contains
a growable array. But there's no need for the environment
abstraction when being used as a temporary holder for values
of locals.

Change-Id: Idf2883fe4b8f97a31ee70b3627c1bdd23ebfff0e
f213e05cef6d38166cfe0cce8f3b0a53225a1b39 27-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Add support for caching float and double constants.

Change-Id: Ib5205bad1006bc5e3c9cc86bc82a6b4b1ce9bef9
3192540155d51a42b340de7afebe83a5eaf23b03 17-Apr-2015 Calin Juravle <calin@google.com> Cleanup unnecessary test conditions in ssa builder.

Change-Id: Ic36e535aec3f977ebe36bfe20bc54a1033de62c6
a4f8831d6533e4fe5aed18433099e1130d95a877 16-Apr-2015 Calin Juravle <calin@google.com> Remove duplicates phis created during SSA transformation

When creating equivalent phis we copy the inputs of the original phi
which may be improperly typed. This will be fixed during the type
propagation but as a result we may have two equivalent phis with the
same type for the same dex register. This is correct but generates more
code and prevent some optimizations.

This CL adds another step in the SSA builder to remove the extra Phi
nodes created due to equality operators.

The graph checker verifies that for a given dex register not two phis
have the same type.

Also, replace zero int constant with null constant when we compare a
reference against null.

Change-Id: Id37cc11a016ea767c7e351575e003d822a9d2e60
3dcd58cd54a922b864494fb7fff4a7f7a8562db9 03-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a bug when creating a HDeoptimization instruction.

We need to copy the environment, instead of just pointing
to an existing one. Otherwise, if the instruction that initially
holds the environemnt gets removed from the graph, any update
to an instruction in that environment will not be reflected in it.

bug:20058506

Change-Id: I2a62476d0851ecbc3707c0da395d8502ee437422
8d5b8b295930aaa43255c4f0b74ece3ee8b43a47 24-Mar-2015 David Brazdil <dbrazdil@google.com> ART: Force constants into the entry block

Optimizations such as GVN and BCE make the assumption that all
constants are located in the entry block of the CFG, but not all
passes adhere to this rule.

This patch makes constructors of constants private and only accessible
to friend classes - HGraph for int/long constants and SsaBuilder for
float/double - which ensure that they are placed correctly and not
duplicated.

Note that the ArenaAllocatorAdapter was modified to not increment
the ArenaAllocator's internal reference counter in order to allow
for use of ArenaSafeMap inside an arena-allocated objects. Because
their destructor is not called, the counter does not get decremented.

Change-Id: I36a4fa29ae34fb905cdefd482ccbf386cff14166
da4d79bc9a4aeb9da7c6259ce4c9c1c3bf545eb8 24-Mar-2015 Roland Levillain <rpl@google.com> Unify ART's various implementations of bit_cast.

ART had several implementations of art::bit_cast:

1. one in runtime/base/casts.h, declared as:

template <class Dest, class Source>
inline Dest bit_cast(const Source& source);

2. another one in runtime/utils.h, declared as:

template<typename U, typename V>
static inline V bit_cast(U in);

3. and a third local version, in runtime/memory_region.h,
similar to the previous one:

template<typename Source, typename Destination>
static Destination MemoryRegion::local_bit_cast(Source in);

This CL removes versions 2. and 3. and changes their callers
to use 1. instead. That version was chosen over the others
as:
- it was the oldest one in the code base; and
- its syntax was closer to the standard C++ cast operators,
as it supports the following use:

bit_cast<Destination>(source)

since `Source' can be deduced from `source'.

Change-Id: I7334fd5d55bf0b8a0c52cb33cfbae6894ff83633
b59dba05697b4ac6c86cb4f45c9222c9c6ad852b 11-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in the SSA builder.

The build would leave behind phis with incompatible input types
(for example float and int). We need another dead phi run after
the type propagation to ensure all such phis are dead.

Change-Id: I6ef1da725c7d4a1ebaf6b52dd7eb0c7bacd261b2
e0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c 09-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Make the SSA builder honor the debuggable flag.

This requires to properly type phis that are only
used by environments, and discard phis with incomptable types.
The code generators do not handle these conflicting types. In
the process, ensure a phi has a type that does not depend
on the order of the inputs (for example (char, short) -> short),
and set int for int-like types. We can refine this later.

Change-Id: I60ab601d6d00b1cbf18623ee4ff1795aa28f84a1
d6138ef1ea13d07ae555542f8898b30d89e9ac9a 18-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Ensure the graph is correctly typed.

We used to be forgiving because of HIntConstant(0) also being
used for null. We now create a special HNullConstant for such uses.

Also, we need to run the dead phi elimination twice during ssa
building to ensure the correctness.

Change-Id: If479efa3680d3358800aebb1cca692fa2d94f6e5
10e244f9e7f6d96a95c910a2bedef5bd3810c637 26-Jan-2015 Calin Juravle <calin@google.com> optimizing: NullCheck elimination

How it works:
- run a type analysis to propagate null information on instructions
- during the last instruction simplifier remove null checks for which
the input is known to be not null

The current type analysis is actually a nullability analysis but it will
be reused in follow up CLs to propagate type information: so it keeps
the more convenient name.

Change-Id: I54bb1d32ab24604b4d677d1ecdaf8d60a5ff5ce9
ed59619b370ef23ffbb25d1d01f615e60a9262b6 23-Jan-2015 David Brazdil <dbrazdil@google.com> Optimizing: Speed up HEnvironment use removal

Removal of use records from HEnvironment vregs involved iterating over
potentially large linked lists which made compilation of huge methods
very slow. This patch turns use lists into doubly-linked lists, stores
pointers to the relevant nodes inside HEnvironment and subsequently
turns the removals into constant-time operations.

Change-Id: I0e1d4d782fd624e7b8075af75d4adf0a0634a1ee
3159674c0863f53cfbc1913d493550221ac47f02 24-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in the type analysis phase of optimizing.

Dex code can lead to the creation of a phi with one
float input and one integer input. Since the SSA builder trusts
the verifier, it assumes that the integer input must be converted
to float. However, when the register is not used afterwards, the
verifier hasn't ensured that. Therefore, the compiler must remove
the phi prior to doing type propagation.

Change-Id: Idcd51c4dccce827c59d1f2b253bc1c919bc07df5
21cc798cd56a069a3d51a0215020676065780939 17-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in the type propagation phase of optimizing.

The compiler was placing phis (and their floating point equivalent),
in a way that it did not expect.

Change-Id: I974be1ee4aae5d27d68c6bba171db0ed25377b70
421e9f9088b51e9680a3dfcae6965fc1854d3ee4 11-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Remove HTemporary when building the SSA graph.

- They are useless afterwards. If we keep them around, they can
crash the dump of the graph, where they always assume a previous
instruction.

- In the call to HTemporary::GetType, check that the previous
instruction exists.

Change-Id: Ie7bf44d05cb61e3654a69725c1980925580dd3a6
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
102cbed1e52b7c5f09458b44903fe97bb3e14d5f 15-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Implement register allocator for floating point registers.

Also:
- Fix misuses of emitting the rex prefix in the x86_64 assembler.
- Fix movaps code generation in the x86_64 assembler.

Change-Id: Ib6dcf6e7c4a9c43368cfc46b02ba50f69ae69cbe
476df557fed5f0b3f32f8d11a654674bb403a8f8 09-Oct-2014 Roland Levillain <rpl@google.com> Use Is*() helpers to shorten code in the optimizing compiler.

Change-Id: I79f31833bc9a0aa2918381aa3fb0b05d45f75689
184d640d2a3ac86d871dab58386a50cc9bb973f9 09-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Add a type propagation phase after building SSA.

This ensures all phis have a type.

Change-Id: I7e4f9a16d1efb5f64c493c1351749b352c870cbd
ec7e4727e99aa1416398ac5a684f5024817a25c7 06-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Fix some bugs in graph construction/simplification methods.

Also fix a brano during SSA construction. The code should
not have been commented out. Added a test to cover what the code
intends.

Change-Id: Ia00ae79dcf75eb0d412f07649d73e7f94dbfb6f0
7c3560f2ce0ec9484004d05a94bfaa6e02f5a96a 04-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in SSA construction.

If a join block does not have an incoming value for a local
from a predecessor block, we should not create a phi. The
verifier has made sure the local is updated before any
following reads after this block.

Change-Id: Id2785efc73c9fb3224826fff2f4b4ad215905ff4
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
a7062e05e6048c7f817d784a5b94e3122e25b1ec 22-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add a linear scan register allocator to the optimizing compiler.

This is a "by-the-book" implementation. It currently only deals
with allocating registers, with no hint optimizations.

The changes remaining to make it functional are:
- Allocate spill slots.
- Resolution and placements of Move instructions.
- Connect it to the code generator.

Change-Id: Ie0b2f6ba1b98da85425be721ce4afecd6b4012a4
f635e63318447ca04731b265a86a573c9ed1737c 14-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add a compilation tracing mechanism to the new compiler.

Code mostly imported from: https://android-review.googlesource.com/#/c/81653/.

Change-Id: I150fe942be0fb270e03fabb19032180f7a065d13
622d9c31febd950255b36a48b47e1f630197c5fe 12-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add loop recognition and CFG simplifications in new compiler.

We do three simplifications:
- Split critical edges, for code generation from SSA (new).
- Ensure one back edge per loop, to simplify loop recognition (new).
- Ensure only one pre header for a loop, to simplify SSA creation (existing).

Change-Id: I9bfccd4b236a00486a261078627b091c8a68be33
804d09372cc3d80d537da1489da4a45e0e19aa5d 02-May-2014 Nicolas Geoffray <ngeoffray@google.com> Build live-in, live-out and kill sets for each block.

This information will be used when computing live ranges of
instructions.

Change-Id: I345ee833c1ccb4a8e725c7976453f6d58d350d74
c32e770f21540e4e9eda6dc7f770e745d33f1b9f 24-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Add a Transform to SSA phase to the optimizing compiler.

Change-Id: Ia9700756a0396d797a00b529896487d52c989329