aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/tools/r8/ir/regalloc
AgeCommit message (Collapse)Author
2017-07-14Fixes a race condition when running R8.Lars Bak
2f4517160f9ce402be795a6555f68b8129cb09da Bug: Change-Id: I9c73bc0b9db9feef1cd2b02e62af21861aee6367
2017-07-13Fix register allocation issues caused by special debug uses.Mads Ager
Debug uses registered on live intervals were sometimes ignored and other times not. That leads to inconsistencies in the register allocator. With this change, debug uses only extend the live range of values but do not register live interval uses. That makes the handling of uses consistent for the register allocator again and still ensures that values are kept alive by debug users in some register. R=herhut@google.com, mikaelpeltier@google.com, sgjesse@google.com, zerny@google.com Bug: 63285632 Bug: 62992398 Change-Id: Ia6515fed81d4d0e23c25631681076a67217a6e75
2017-07-06Emit local changes accurately at all instruction points.Ian Zerny
Bug: 63243012 Change-Id: I874308618da6366b79b68e5b8eb0c0e1b08aa447
2017-07-05Don't consider debug-value uses as actual uses.Ian Zerny
R=ager, sgjesse Bug: 63285632 Bug: 62992398 Change-Id: Id9b28043e2e1acf14bdc40b47ea7a7bd7f4a602b
2017-07-04Merge "Update test comparing used registers with highest register number"Mikael Peltier
2017-07-04Update test comparing used registers with highest register numbermikaelpeltier
- It allow to save about 6k when dexing deploy.jar of GMS core v10. Change-Id: I5bf56a3e24d0634fc797706d352c175bd9f19c6d
2017-07-04Merge "Replace DebugLocalRead instruction by annotations directly on ↵Ian Zerny
instructions."
2017-07-03Replace DebugLocalRead instruction by annotations directly on instructions.Ian Zerny
This is in preperation for emitting exact local changes which requires that the scope-end of a local is attached to the instruction at which it ends. The use of debug-local read instructions did not allow this for, eg, exiting instrucitons. R=ager, sgjesse, shertz Bug: 63243012 Change-Id: I4423452089180654afba982f42f07cf06f757791
2017-07-03Update register hint even for argumentmikaelpeltier
Change-Id: Iede432822dd6801b5de6d0590b418c9ab5830c2d
2017-06-30Fix another off-by-one error in local range computation related to ↵Ian Zerny
https://r8-review.googlesource.com/c/1983/ R=ager Bug: Change-Id: I835d984e93acb573117c292835644ad9b7a88b7a
2017-06-28Merge "Fix off-by-one error in range computation."Ian Zerny
2017-06-27Generate better code for ranged invokes in debug mode.Mads Ager
The register allocator inserts moves for arguments to ranged invokes in order to give the register allocator complete freedom in selecting registers for those arguments. However, debug instructions are also moves and therefore, we often don't have to generate extra argument moves in order to have enough freedom in register selection. This change avoids generating argument moves when the input is already the result of a move to an unconstrained value that can be linked into the current argument chain. This saves around 40kB on GMSCore v10 deploy jar dexing. R=mikaelpeltier@google.com, zerny@google.com Bug: 62992398 Change-Id: I60f89d06e25c4347c3a688ed65fd99b75e477986
2017-06-27Fix off-by-one error in range computation.Ian Zerny
Change-Id: Id87f76e715ba060fed8bbbf74f85184fe455784a
2017-06-27Don't associate local info with argument moves.Ian Zerny
Change-Id: I210bb2433e419971c02e668e8f60e6d833c5883e
2017-06-26Merge "Don't consider local-associated SSA values as constants."Ian Zerny
2017-06-23Don't consider local-associated SSA values as constants.Ian Zerny
Change-Id: I1b453912503efc586169a7c262c463308d5d8cbb
2017-06-23Pin this register in debug mode.Mads Ager
Bug: 62895996 R=zerny@google.com Change-Id: Ia0b1b39f34acd3d99bfe995bb7b67567bbb0f034
2017-06-21Change register allocator to deal better with unconstrained uses.Mads Ager
When low on registers, if the interval we are currently attempting to allocate a register for has an unconstrained first use, split the current interval instead of finding another interval to split. In addition, make the determination of when to split argument values right after their definition more precise. These changes shouldn't matter much at this point. However, zerny@ is working on changes to debug information handling that will make this occur a lot more for arguments. For such cases this is needed and generates better code than we currently do. R=zerny@google.com Change-Id: I6d83b91a15486d294c2c66f68b17cb871c0cbae1
2017-06-19Update how register candidate is chosenmikaelpeltier
- Firstly try to find a register candidate that is a constant that can be rematerialized. If it does not exist or if hos live range is too short, fallback to select a register that can not be rematerialized. It allows to save 14608 bytes on GMSCore V10(deploy jar), 15080 bytes on GMSCore v9 (deploy jar) and for dex file related to the bug, it allows to have 49880 bytes instead of 56380 bytes in debug mode and it allows to have 48424 bytes instead of 55324 in release mode. BUG: 62475297 Change-Id: I497c13a4c3dd8bdd6acafc6e2a3197648604035f
2017-06-19Remove code that set use position of registerMikaël Peltier
- It seems that this code can not change value already setted. Change-Id: I5999c002bc01e2d105aa0cc4c3790d1e254112cc
2017-06-14Merge "Make it less likely that Art lock verification gets confused."Mads Ager
2017-06-14Merge "Catch more cases of invalid input and give CompilationErrors."Mads Ager
2017-06-14Catch more cases of invalid input and give CompilationErrors.Mads Ager
Previously these cases would lead to null pointer exceptions or assertion errors. R=sgjesse@google.com, vnukov@google.com Change-Id: I9684379ffbc98106bd9c4a8753861f682cb13b83
2017-06-14Update heuristics to compute live range of constantmikaelpeltier
- Keep constant alive for a shorter range slightly decrease dex size of GMSCore v9 and V10 (few bytes) in release mode but it allow to decrease the dex size for the case in the attached bug to 55324 bytes instead of 64268 bytes in release mode and to 56380 bytes instead of 60460 bytes. Bug: 62475297 Change-Id: I42c1cf99f44714b249c62e45efbab4ac4d7e8b26
2017-06-13Make it less likely that Art lock verification gets confused.Mads Ager
When locking on argument values, use the argument register for all lock operations whenever possible. In all but the most obscure cases that should be possible. However, it is not bullet-proof and when the argument registers become too high we will have to use another register for it and lock verification will get confused by the splitting and print a warning. That shouldn't be treated as a fatal error, but we can attempt to avoid it as much as possible. R=acleung@google.com Bug: 62475512 Change-Id: Ia4358e38aacfb90e79167d4b5144afa80d9cc30b
2017-06-08Introduce fewer argument moves for ranged invokes.Mads Ager
When a ranged invoke is just forwarding a sub-sequence of the incoming argument registers there is no need to introduce moves that might end up being materialized. Instead we can use the original argument registers. This is the first patch set of https://r8-review.googlesource.com/c/1360/ with the addition of special handling for getting the allocated register for ranged invokes. Gives around 10kB savings on dexing the gmscore v10 deploy jar. R=mikaelpeltier@google.com Change-Id: I6ee816cb2ffffdaadd44f4af2b2ba18d9ebadd14
2017-06-07Fix the workaround for overlapping long registers art bug.Mads Ager
We compute candidate registers in two places but only one of them had the workaround code. Creating a small test case is hard, so I added another full app verification test to the suite to catch this. R=sgjesse@google.com Bug: Change-Id: I00e7b77966edbdd6924f49dbe95e78f745fc8384
2017-06-02Remove the original register field from values.Mads Ager
The only bit that is a little funky here is the mapping to and from negative register values for incomplete phis on exceptional edges. R=sgjesse@google.com, zerny@google.com Change-Id: If4aa465c2ea64f0f7177f3f37fee162e55fe2408
2017-06-01Merge "Inline some reg alloc methods that have become trivial."Mads Ager
2017-06-01Inline some reg alloc methods that have become trivial.Mads Ager
R=sgjesse@google.com Change-Id: Ia6538493b3e5a0328c7243f633204e3600fc53d9
2017-05-31Merge "Add support for Proguard keep option modifier includedescriptorclasses"Søren Gjesse
2017-05-31Add support for Proguard keep option modifier includedescriptorclassesSøren Gjesse
This also adds a new separate tree-shaking test structure. Bug: 36846279 R=herhut@google.com Change-Id: If4f4bd8738130a02a5c79651de82d382630a3ec2
2017-05-31Use the original argument register as the spill register for arguments.Mads Ager
This ensures that we do not move the argument values around when we know that argument reuse is disallowed in any case. R=zerny@google.com Change-Id: I1923e2417c14d84d446a1a4bf1e5af60df89fc58
2017-05-31Improve argument register selection and debug info handling.Mads Ager
When allocating a register for an argument value split with no register constraint, just use the original argument register. For debug info, always use the original argument register for an argument value. When we have splits we know that we have disallowed argument register reuse and therefore the argument value is always available in the original argument register. R=zerny@google.com Bug: 62186207 Change-Id: I1139213142e762d316a3eb2f3fcb52e8e0bdfe59
2017-05-30Tweak handling of arguments when argument register reuse is disabled.Mads Ager
If there are multiple uses of an argument value, split it right after its definition instead of at the first use. This makes it more likely that arguments get in useful registers initially and reduces the amount of argument moves needed. This reduces the GMSCore v10 debug build size by 20kB and reduces a simple debug dex file size from 15kB to 13kB. R=zerny@google.com Bug: 38375244 Change-Id: Ibfe45500a87c73a91dad6bbcfdb048dd590e5efb
2017-05-24Avoid using non-argument registers for arguments when we can.Mads Ager
This saves around 4kB when dexing gmscore. Redoing the move insertion is a little heavy weight but with the current parallel move scheduling I cannot reliably put a bound on the amount of temporary registers it will need (even though I haven't seen more than 4 ever). Therefore, I have to postpone the determination until the very end and redo insertion. R=sgjesse@google.com Change-Id: I440ec35460033b5c6eb25f161ff1740c91eee2d9
2017-05-23Fix isRematerializable to always use the unadjusted real register number.Mads Ager
This ensures that isRematerializable returns the same value for the same interval both when generating moves and when performing peephole optimizations. Change-Id: I2953fac1db981e045c61b7c9717098c2479862a6
2017-05-22Initial push.Mads Ager