summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlexei Zavjalov <alexei.zavjalov@intel.com>2014-04-21 20:45:24 +0700
committerAlexei Zavjalov <alexei.zavjalov@intel.com>2014-04-21 20:45:24 +0700
commit9d894662426e413454935e483d56a8cc33924174 (patch)
tree6ae3c812e6a56401fb98a074f77f27f4bc7ba13e /test
parent86e1b5e7e2bca99dd2092eab8ced977d97830873 (diff)
downloadandroid_art-9d894662426e413454935e483d56a8cc33924174.tar.gz
android_art-9d894662426e413454935e483d56a8cc33924174.tar.bz2
android_art-9d894662426e413454935e483d56a8cc33924174.zip
Skip BBs without SSA representation in the Constant Propagation phase
In some cases the constant propagation optimization may get the MIR graph where some of the BBs have no predecessors and do not transformed to the SSA form. If such BB has operations on constants this may lead to segfault. This patch adds the condition that will pass the only BBs with SSA. Change-Id: I816d46b2492c5bd4748f983c3725b4798f9ebd68 Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/083-compiler-regressions/expected.txt1
-rw-r--r--test/083-compiler-regressions/src/Main.java27
2 files changed, 28 insertions, 0 deletions
diff --git a/test/083-compiler-regressions/expected.txt b/test/083-compiler-regressions/expected.txt
index db5030022b..7576b02752 100644
--- a/test/083-compiler-regressions/expected.txt
+++ b/test/083-compiler-regressions/expected.txt
@@ -16,6 +16,7 @@ b13679511Test finishing
largeFrame passes
largeFrameFloat passes
mulBy1Test passes
+constantPropagationTest passes
getterSetterTest passes
identityTest passes
wideGetterSetterTest passes
diff --git a/test/083-compiler-regressions/src/Main.java b/test/083-compiler-regressions/src/Main.java
index d32c037afd..6a12ca93f7 100644
--- a/test/083-compiler-regressions/src/Main.java
+++ b/test/083-compiler-regressions/src/Main.java
@@ -38,6 +38,7 @@ public class Main {
largeFrameTest();
largeFrameTestFloat();
mulBy1Test();
+ constantPropagationTest();
getterSetterTest();
identityTest();
wideGetterSetterTest();
@@ -766,6 +767,32 @@ public class Main {
}
}
+ static void constantPropagationTest() {
+ int i = 1;
+ int t = 1;
+ float z = 1F;
+ long h = 1L;
+ int g[] = new int[1];
+ int w = 1;
+ long f = 0;
+
+ for (int a = 1; a < 100; a++) {
+ try {
+ i = (int)(z);
+ h >>= (0 % t);
+ }
+ finally {
+ w = (int)(2 * (f * 6));
+ }
+ }
+
+ if (w == 0 && h == 1 && g[0] == 0) {
+ System.out.println("constantPropagationTest passes");
+ } else {
+ System.out.println("constantPropagationTest fails");
+ }
+ }
+
static void b2296099Test() throws Exception {
int x = -1190771042;
int dist = 360530809;