summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_analysis_test.cc
AgeCommit message (Collapse)Author
2017-11-16cpplint: Remove many unnecessary NOLINTIgor Murashkin
Now that we updated to upstream cpplint, a lot of these NOLINTs are no longer necessary. Bug: 68951293 Change-Id: If8ed5ffe89727f313f907a214b6d8fd2a2eddbad
2017-11-08cpplint: Cleanup errorsIgor Murashkin
Cleanup errors from upstream cpplint in preparation for moving art's cpplint fork to upstream tip-of-tree cpplint. Test: cd art && mm Bug: 68951293 Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
2017-10-06ART: Use ScopedArenaAllocator for pass-local data.Vladimir Marko
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
2017-09-25ART: Introduce compiler data type.Vladimir Marko
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
2017-03-27ART: Clean up field initializationAndreas Gampe
Add explicit field initialization to default value where necessary. Also clean up interpreter intrinsics header. Test: m Change-Id: I7a850ac30dcccfb523a5569fb8400b9ac892c8e5
2016-12-19Improved induction var and range analysis around types.Aart Bik
Rationale: Lots of code should not depend on int only. This CL generalizes the kinds of types that can be optimized after analysis. As part of the CL, however, a minor cleanup regarding type safety of the stored induction var analysis results is required. This further improved our int benchmark, and brings the long benchmark up-to-par. Test: m test-art-host-run-test Change-Id: I5dfb623dabf9113de90c2f6da99328dda8f8b60b
2016-12-15Fine tuning the induction analysis.Aart Bik
Rationale: Based on some self-imposed "blind" testing, improved the induction variable analysis for typical cases that provide a bit more elaborate HIR. Test: test-art-host Change-Id: I6e6bbf99928c29973178fa48f3942b14bf069944
2016-12-09Added polynomial induction variables analysis. With tests.Aart Bik
Rationale: Information on polynomial sequences is nice to further enhance BCE and last-value assignment. In this case, this CL enables more loop optimizations for benchpress' Sum (80 x speedup). Also changed rem-based geometric induction to wrap-around induction. Test: test-art-host Change-Id: Ie4d2659edefb814edda2c971c1f70ba400c31111
2016-12-05Added geometric induction variables analysis.Aart Bik
Rationale: Information on geometric and polynomial (coming soon) sequences are nice to have to further enhance BCE and last-value assignment. Test: test-art-host Change-Id: Ib5e2998c3eb1009def6fd00b82935da7c3ba7c6e
2016-11-21ART: Add dex::TypeIndexAndreas Gampe
Add abstraction for uint16_t type index. Test: m test-art-host Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a
2016-10-24Improved induction variable analysis and loop optimizations.Aart Bik
Rationale: Rather than half-baked reconstructing cycles during loop optimizations, this CL passes the SCC computed during induction variable analysis to the loop optimizer (trading some memory for more optimizations). This further improves CaffeineLogic from 6000us down to 4200us (dx) and 2200us to 1690us (jack). Note that this is on top of prior improvements in previous CLs. Also, some narrowing type concerns are taken care of during transfer operations. Test: test-art-host Change-Id: Ice2764811a70073c5014b3a05fb51f39fd2f4c3c
2016-10-20Improve recognition of select-based period induction.Aart Bik
Rationale: Similar to the previous CL, this helps to eliminate more dead induction. Now, CaffeineLogic, when compiled with dx (rather than jack) improves by a 1.5 speedup (9000us -> 6000us). Note: We need to run the simplifier before induction analysis to trigger the select simplification first. Although a bit of a compile-time hit, it seems a good idea to run a simplifier here again anyway. Test: test-art-host Change-Id: I93b91ca40a4d64385c64393028e8d213f0c904a8
2016-10-12Recognize XOR-based periodic induction.Aart Bik
Rationale: This is a commonly used construct (e.g. x = !x for booleans and x ^= 1 for integers). This CL prepares some upcoming optimizations that exploit such inductions. Change-Id: I46edffb9de1075a836995daf5c2dfff7891f3034 Test: 530-checker-loops2 and induction_var_analysis_test
2016-09-16Minor induction variable analysis changes.Aart Bik
Rationale: Few extra comments, added replacement of loop control functionality. All in preparation of bigger loop optimizations CL. Change-Id: Ie2243c3c8b57b2901654b05fb200e9d80a0cb641 Test: test-art
2016-03-25Fix bug not accounting for type in induction comparison.Aart Bik
Extended unit tests. Rationale: Now that inductions are typed, comparisons should take the type into account as well. Change-Id: Ie533bb728d2006390646657573fa743e6fc37ff2
2016-03-21Generalize induction and range analysis across type conversions.Aart Bik
Rationale: This changelist implements allowing narrowing conversions within inductions and loop control. More induction and loops recognized, more bounds eliminated. We all win. The basic idea is pretty simple (record type with detected induction) but one has to get all the details right, as illustrated by the many new unit tests. BUG=27151098 Change-Id: I254020bfa5fa623799b31bbbb5ccc97d4d5a0100
2016-02-15Fix lint errorDavid Brazdil
Change-Id: I6f7785abece7ead31b4737fc6b54712c26582e2b
2016-02-15ART: Run SsaBuilder from HGraphBuilderDavid Brazdil
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
2016-01-06ART: Resolve ambiguous ArraySetsDavid Brazdil
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
2015-12-31ART: Refactor SsaBuilder for more precise typing infoDavid Brazdil
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
2015-12-15Revert "ART: Refactor SsaBuilder for more precise typing info"Alex Light
This reverts commit d9510dfc32349eeb4f2145c801f7ba1d5bccfb12. Bug: 26208284 Bug: 24252151 Bug: 24252100 Bug: 22538329 Bug: 25786318 Change-Id: I5f491becdf076ff51d437d490405ec4e1586c010
2015-12-14ART: Refactor SsaBuilder for more precise typing infoDavid Brazdil
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
2015-11-09ART: Fix critical edge splitting under try/catchDavid Brazdil
A critical edge would not be split if the predecessor ends with TryBoundary. This would eventually trip liveness analysis because a back edge block would have smaller liveness position than a nested loop. Another implication of this change is that an edge between a loop's pre-header ending with TryBoundary and the header will be split, guaranteeing that a pre-header always has just one successor. Bug: 25493695 Bug: 25454012 Change-Id: I5a13b8bb74509b48f5d628906f7158af007f99ae
2015-10-28Generate taken-test during trip-count analysis.Aart Bik
Rationale: for loops that may not be taken, this taken-test can be used by clients of the induction variable analysis to ensure trip-count evaluation is valid. Change-Id: Ia64749e2389b7224e69d6a49bb604b1964c11068
2015-10-20Merge "Revert "Revert "optimizing: propagate type information of arguments"""Calin Juravle
2015-10-19Added ability to generate induction range code.Aart Bik
Rationale: used by dynamic BCE (done in another CL). Change-Id: Ia6ce75da57b5298fba74622822ae0bae69c74188
2015-10-14Revert "Revert "optimizing: propagate type information of arguments""Calin Juravle
This reverts commit 89c0d32437011bbe492fe14c766cd707046ce043. Change-Id: I603a49794e155cc97410b8836c8ea425bfdc98eb
2015-10-13Revert "optimizing: propagate type information of arguments"Calin Juravle
This reverts commit 2c1ffc3a06e9ed0411e29e7dc2558b5d657ede7a. Change-Id: I3291070c373e661fa578f5a38becbb5a502baf94
2015-10-12optimizing: propagate type information of argumentsCalin Juravle
This helps inlining and type check elimination. e.g: void foo(ArrayList a) { int size = a.size(); // this can be inlined now. } Change-Id: I3ffeaa79d9df444aa19511c83c544cb5f9d9ab20
2015-09-30Implemented trip-count safety information.Aart Bik
As shown in the induction analysis presentation, trip-counts need to deal with potential taken/not-taken situations (so that trip-count is either valid in the full loop or just in the loop-body proper) and potential finite/infinite situations (the latter can still be analyzed but may need to run-time test later to guard against the infinite conditions). This CL provides that information. Change-Id: I0445d8e836b80a3614af217ce3e39d766e77b986
2015-09-23Various improvements in finding induction variables.Aart Bik
Rationale: (1) Analyze multi-way phis (requested by Nicolas, Igor, and Mingyao). (2) Analyze trip count for restricted != loops (3) Added unit test for public API of range analysis (static methods were already well-tested). Change-Id: I9285d22d3bb927f141204cc4697ea6fe5120994d
2015-09-10Induction variable range analysis.Aart Bik
Rationale: by computing an upper bound on the trip count of each loop after induction var analysis has completed, a simple range analysis yields lower and upper bounds on all induced expressions in a loop; this analysis plugs directly into BCE (follow-up CL). Change-Id: I46a3fe48721ca372547199b39a3498c47992597d
2015-09-07Simplify loop invariant operations during induction analysis.Aart Bik
Rationale: Saves some memory for nodes that are not really required, and yields slightly more readable debugging strings. Change-Id: I95b64b48869699137b5d49e26eb20091e264de7a
2015-09-04Further development of induction variable analysis.Aart Bik
Various improvements: (1) Introduced period sequences. (2) Extended all transfer functions to deal with all cases; also refactored these to read more compactly. (3) Improved debugging output for constants for readability. (4) Used direct pointer in mappings for clarify. (5) Several induction info "constructors" for readability. (6) Various other changes suggested in earlier code reviews. Change-Id: I9d5381f1676b63d30cea6f5e304d4b7bda7acb96
2015-08-26Induction variable analysis (with unit tests).Aart Bik
Rationale: Induction variable analysis forms the basis of a wide variety of compiler optimizations. This implementation finds induction variables using the elegant SSA-based algorithm defined by [Gerlek et al.]. Change-Id: I79b8dce33ffb8b283c179699a8dff5bd196f75b2