summaryrefslogtreecommitdiff
path: root/compiler/optimizing/superblock_cloner.cc
AgeCommit message (Collapse)Author
2025-02-17Optimizing: Speed up `HInstruction::Add{,Env}UseAt()`. Vladimir Marko
Avoid three dependent loads to fetch the allocator on the hot paths. Inline the `FixupUserRecordsAfter*UseInsertion()` loop and use the fact that it's known to execute exactly one or two iterations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: I7fd4d48caebc6aeb13fb9a9f8146a06129c72b2e
2025-01-03Remove superblock cloner's DoVersioning Santiago Aboy Solanes
It was added back in 2020 (r.android.com/1206763) but never used. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Iace09f956bd520732588b3623722b74f6559a1fe
2024-11-21Add comment and dcheck regarding SuperblockCloner edge case Santiago Aboy Solanes
Based on a comment in r.android.com/3365219. Bug: 368984521 Test: art/test/testrunner/testrunner.py -b --host --64 --optimizing Change-Id: Ic8b945ba418df380158456bfb295edfd1dc0ad01
2024-11-21Fix LoopElimination mistakenly eliminating a loop Santiago Aboy Solanes
This resulted in a crash for debug builds, and mistakes in the optimizations for release builds. It requires a variable to be used in the loop we are unrolling as well as in a catch phi that it is not part of the loop we are unrolling. We could potentially fully unroll that loop, but this requires a refactor on how SuperblockCloner works. This CL makes it so that we won't optimize such loops, which should be rare enough to not cause any visible regressions. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Bug: 368984521 Fixes: 368984521 Change-Id: I39f88586358573bbe76d9369d4ec67a942fd3eec
2024-10-04Reduce memory used by `HEnvironment`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Ie05d4001e411a669e11b8edda375414e5da52ae2
2024-03-25Remove extra uses of ClearAllBits Santiago Aboy Solanes
ArenaBitVector creation guarantees it starts empty. Add a debug check to make sure this assumption doesn't change. Note that ArenaAllocator guarantees zero-initialized memory but ScopedArenaAllocators do not. This is fine either way since the BitVector constructor calls ClearAllBits. Bug: 329037671 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Icbf5e5dd1869e80b5d5828ecca9f13de30c0242b
2024-03-12Remove default cases when all cases are defined Santiago Aboy Solanes
Bug: 328756212 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: m test-art-host-gtest Change-Id: I9584e1b93e49265b84a9e45c8b283ebaf8ad3eb2
2023-04-27Optimizing: Add `HInstruction::As##type()`. Vladimir Marko
After the old implementation was renamed in https://android-review.googlesource.com/2526708 , we introduce a new function with the old name but new behavior, just `DCHECK()`-ing the instruction kind before casting down the pointer. We change appropriate calls from `As##type##OrNull()` to `As##type()` to avoid unncessary run-time checks and reduce the size of libart-compiler.so. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 181943478 Change-Id: I025681612a77ca2157fed4886ca47f2053975d4e
2023-04-27Optimizing: Rename `As##type` to `As##type##OrNull`. Vladimir Marko
The null type check in the current implementation of `HInstruction::As##type()` often cannot be optimized away by clang++. It is therefore beneficial to have two functions HInstruction::As##type() HInstruction::As##type##OrNull() where the first function never returns null but the second one can return null. The additional text "OrNull" shall also flag the possibility of yielding null to the developer which may help avoid bugs similar to what we have seen previously. This requires renaming the existing function that can return null and introducing new function that cannot. However, defining the new function `HInstruction::As##type()` in the same change as renaming the old one would risk introducing bugs by missing a rename. Therefore we simply rename the old function here and the new function shall be introduced in a separate change with all behavioral changes being explicit. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: buildbot-build.sh --target Bug: 181943478 Change-Id: I4defd85038e28fe3506903ba3f33f723682b3298
2023-02-22Set more RTI only if they are valid Santiago Aboy Solanes
Follow-up to aosp/2442280. We haven't seen crashes with these ones, but we can't guarantee that the RTI will be valid in these code paths. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I80da85a6549ba0275a80027016363e0cf9fb8045
2022-11-07Reland "Make compiler/optimizing/ symbols hidden." VladimĂ­r Marko
This reverts commit 0a51605ddd81635135463dab08b6f7c21b58ffb0. Reason for revert: Reland after some of the required work was merged in other CLs. Also address a TODO from the original CL to mark required symbols with EXPORT in `intrinsic_objects.h`. Also mark symbols in new files as HIDDEN. Bug: 186902856 Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I936d448983928af23614ca82c2d0bf9a645e2c52
2022-04-14Enable LoopOptimization for graphs with try catch blocks Santiago Aboy Solanes
We can enable the optimization when the graph has try catch blocks, but we do not perform the optimizations if the loops themselves have try catch blocks. Bug: 227283906 Change-Id: I8889d2ed7a5a260d5c2dcbbc5184cb7eaf3a8f9f
2022-02-25Update compiler/ implications to use (D)CHECK_IMPLIES Santiago Aboy Solanes
Follow-up to aosp/1988868 in which we added the (D)CHECK_IMPLIES macro. This CL uses it on compiler/ occurrences found by a regex. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: If63aed969bfb8b31d6fbbcb3bca2b04314c894b7
2020-05-01ART: Introduce Loop Versioning in SuberblockCloner. Artem Serov
Support Loop Versioning in SuberblockCloner as a tool to enable further optimization (e.g. Dynamic Loop Unrolling). The patch brings the feature in without enabling it. Replace std::cout with LOG(INFO) for debug dumps. Test: superblock_cloner_test. Test: test-art-target. Change-Id: I303cabfb752b8c3c8597abfc0ac261e8616e8cee
2020-04-17ART: Refactor SIMD slots and regs size processing. Artem Serov
ART vectorizer assumes that there is single size of SIMD register used for the whole program. Make this assumption explicit and refactor the code. Note: This is a base for the future introduction of SIMD slots of size other than 8 or 16 bytes. Test: test-art-target, test-art-host. Change-Id: Id699d5e3590ca8c655ecd9f9ed4e63f49e3c4f9c
2019-10-14Revert "Make compiler/optimizing/ symbols hidden." Vladimir Marko
This reverts commit e2727154f25e0db9a5bb92af494d8e47b181dfcf. Reason for revert: Breaks ASAN tests (ODR violation). Bug: 142365358 Change-Id: I38103d74a1297256c81d90872b6902ff1e9ef7a4
2019-10-14Make compiler/optimizing/ symbols hidden. Vladimir Marko
Make symbols in compiler/optimizing hidden by a namespace attribute. The unit intrinsic_objects.{h,cc} is excluded as it is needed by dex2oat. As the symbols are no longer exported, gtests are now linked with the static version of the libartd-compiler library. libart-compiler.so size: - before: arm: 2396152 arm64: 3345280 - after: arm: 2016176 (-371KiB, -15.9%) arm64: 2874480 (-460KiB, -14.1%) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 142365358 Change-Id: I1fb04a33351f53f00b389a1642e81a68e40912a8
2019-04-30Update induction ranges in superblock cloner. Nicolas Geoffray
Because loop unrolling is part of a general loop optimization pass, it needs to update induction ranges as it will invalidate its instruction cache with new instructions. Bug: 131174583 Test: 696-loop Change-Id: Id3628efe316b58f69abbd9ebd43e891a8e42529f
2018-06-21Use HashSet<std::string> instead of unordered_set<>. Vladimir Marko
Change the default parameters for HashSet<std::string> to allow passing StringPiece as a key, avoiding an unnecessary allocation. Use the HashSet<std::string> instead of std::unordered_set<std::string>. Rename HashSet<> functions that mirror std::unordered_multiset<> to lower-case. Fix CompilerDriver::LoadImageClasses() to avoid using invalidated iterator. Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: I7f8b82ee0b07befc5a0ee1c420b08a2068ad931e
2018-05-24ART: SBC: Support single exit loops with live_outs. Artem Serov
Support copying subgraphs with a single exit and live-outs - values which are defined inside the subgraph and have uses outside. Test: test-art-target, test-art-host. Test: 530-checker-peel-unroll. Change-Id: Id06a6f08d14c6e86f6437d662e24489f955e9edf
2018-04-17ART: Implement scalar loop peeling. Artem Serov
Implement scalar loop peeling for invariant exits elimination (on arm64). If the loop exit condition is loop invariant then loop peeling + GVN + DCE can eliminate this exit in the loop body. Note: GVN and DCE aren't applied during loop optimizations. Note: this functionality is turned off by default now. Test: test-art-host, test-art-target, boot-to-gui. Change-Id: I98d20054a431838b452dc06bd25c075eb445960c
2018-03-26ART: Implement scalar loop unrolling. Artem Serov
Implement scalar loop unrolling for small loops (on arm64) with known trip count to reduce loop check and branch penalty and to provide more opportunities for instruction scheduling. Note: this functionality is turned off by default now. Test: cloner_test.cc Test: test-art-target, test-art-host Change-Id: Ic27fd8fb0bc0d7b69251252da37b8b510bc30acc
2018-03-07ART: Implement loop peeling/unrolling routines. Artem Serov
Implement loop peeling/unrolling routines using SuperblockCloner. Fixes bug b/74198030 and provides tests for it. Bug: b/74198030 Test: superblock_cloner_test.cc, loop_optimization_test.cc. Change-Id: Id0d9a91575c88f8e45186441b14e903b89b007dd
2018-01-09ART: Implement SuperblockCloner. Artem Serov
SuperblockCloner provides a feature of cloning subgraphs in a smart, high level way without fine grain manipulation with IR; data flow and graph properties are resolved/adjusted automatically. The clone transformation is defined by specifying a set of basic blocks to copy and a set of rules how to treat edges, remap their successors. By using this approach such optimizations as Branch Target Expansion, Loop Peeling, Loop Unrolling can be implemented. Test: superblock_cloner_test.cc. Change-Id: Ibeede38195376ca35f44ba9015491e50b3a5b87e