diff options
author | Bill Buzbee <buzbee@android.com> | 2014-04-25 16:36:07 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-25 16:36:07 +0000 |
commit | e8256e7773a230337c3d137cbf0365f737820405 (patch) | |
tree | 2dcf9fd9db72ad4205804521e80d87f07aa61eb8 | |
parent | 3f4dcdf6c99f90a2301304d26ce29dc637b4be7f (diff) | |
parent | 9d894662426e413454935e483d56a8cc33924174 (diff) | |
download | art-e8256e7773a230337c3d137cbf0365f737820405.zip art-e8256e7773a230337c3d137cbf0365f737820405.tar.gz art-e8256e7773a230337c3d137cbf0365f737820405.tar.bz2 |
Merge "Skip BBs without SSA representation in the Constant Propagation phase"
-rw-r--r-- | compiler/dex/mir_optimization.cc | 5 | ||||
-rw-r--r-- | test/083-compiler-regressions/expected.txt | 1 | ||||
-rw-r--r-- | test/083-compiler-regressions/src/Main.java | 27 |
3 files changed, 33 insertions, 0 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 51419f4..937e258 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -42,6 +42,11 @@ void MIRGraph::DoConstantPropagation(BasicBlock* bb) { MIR* mir; for (mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { + // Skip pass if BB has MIR without SSA representation. + if (mir->ssa_rep == NULL) { + return; + } + uint64_t df_attributes = oat_data_flow_attributes_[mir->dalvikInsn.opcode]; DecodedInstruction *d_insn = &mir->dalvikInsn; diff --git a/test/083-compiler-regressions/expected.txt b/test/083-compiler-regressions/expected.txt index db50300..7576b02 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 d32c037..6a12ca9 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; |