diff options
author | David Brazdil <dbrazdil@google.com> | 2016-01-26 11:28:37 +0000 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2016-01-28 15:48:00 +0000 |
commit | b3e773eea39a156b3eacf915ba84e3af1a5c14fa (patch) | |
tree | 6c0d3a748d7b445a0d776ed306c7add43a0e1dd3 /test/565-checker-condition-liveness | |
parent | 05aeb408f292d8d94af1646a94bc69faf77f0b46 (diff) | |
download | art-b3e773eea39a156b3eacf915ba84e3af1a5c14fa.tar.gz art-b3e773eea39a156b3eacf915ba84e3af1a5c14fa.tar.bz2 art-b3e773eea39a156b3eacf915ba84e3af1a5c14fa.zip |
ART: Implement support for instruction inlining
Optimizing HIR contains 'non-materialized' instructions which are
emitted at their use sites rather than their defining sites. This
was not properly handled by the liveness analysis which did not
adjust the use positions of the inputs of such instructions.
Despite the analysis being incorrect, the current use cases never
produce incorrect code.
This patch generalizes the concept of inlined instructions and
updates liveness analysis to set the compute use positions correctly.
Change-Id: Id703c154b20ab861241ae5c715a150385d3ff621
Diffstat (limited to 'test/565-checker-condition-liveness')
-rw-r--r-- | test/565-checker-condition-liveness/expected.txt | 0 | ||||
-rw-r--r-- | test/565-checker-condition-liveness/info.txt | 1 | ||||
-rw-r--r-- | test/565-checker-condition-liveness/src/Main.java | 35 |
3 files changed, 36 insertions, 0 deletions
diff --git a/test/565-checker-condition-liveness/expected.txt b/test/565-checker-condition-liveness/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/565-checker-condition-liveness/expected.txt diff --git a/test/565-checker-condition-liveness/info.txt b/test/565-checker-condition-liveness/info.txt new file mode 100644 index 0000000000..67b6ceb53f --- /dev/null +++ b/test/565-checker-condition-liveness/info.txt @@ -0,0 +1 @@ +Test the use positions of inputs of non-materialized conditions.
\ No newline at end of file diff --git a/test/565-checker-condition-liveness/src/Main.java b/test/565-checker-condition-liveness/src/Main.java new file mode 100644 index 0000000000..a811e5bb16 --- /dev/null +++ b/test/565-checker-condition-liveness/src/Main.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + + /// CHECK-START: void Main.main(java.lang.String[]) liveness (after) + /// CHECK: <<X:i\d+>> ArrayLength uses:[<<UseInput:\d+>>] + /// CHECK: <<Y:i\d+>> StaticFieldGet uses:[<<UseInput>>] + /// CHECK: <<Cond:z\d+>> LessThanOrEqual [<<X>>,<<Y>>] + /// CHECK-NEXT: If [<<Cond>>] liveness:<<LivIf:\d+>> + /// CHECK-EVAL: <<UseInput>> == <<LivIf>> + 1 + + public static void main(String[] args) { + int x = args.length; + int y = field; + if (x > y) { + System.nanoTime(); + } + } + + public static int field = 42; +} |