diff options
| -rw-r--r-- | compiler/optimizing/nodes.cc | 1 | ||||
| -rw-r--r-- | test/562-bce-preheader/src/Main.java | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index c057eca434..3dda8501d2 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -858,7 +858,6 @@ void HEnvironment::CopyFromWithLoopPhiAdjustment(HEnvironment* env, // At the end of the loop pre-header, the corresponding value for instruction // is the first input of the phi. HInstruction* initial = instruction->AsPhi()->InputAt(0); - DCHECK(initial->GetBlock()->Dominates(loop_header)); SetRawEnvAt(i, initial); initial->AddEnvUseAt(this, i); } else { diff --git a/test/562-bce-preheader/src/Main.java b/test/562-bce-preheader/src/Main.java index 8de0533591..8b527b4f63 100644 --- a/test/562-bce-preheader/src/Main.java +++ b/test/562-bce-preheader/src/Main.java @@ -70,6 +70,26 @@ public class Main { return acc; } + /** + * An artificial example with an inconsistent phi structure during + * dynamic bce that is corrected afterwards. Note that only the last + * assignment is really live, but the other statements set up an + * interesting phi structure. + */ + private static int doit(int[] z) { + int a = 0; + for (int i = 0; i < 10; ++i) { + for (int j = i; j < 10; ++j) { + a = z[i]; + for (int k = 0; k < 10; ++k) { + a += z[k]; + a = z[i]; + } + } + } + return a; + } + public static void main(String args[]) { int[][] x = new int[2][2]; int y; @@ -96,6 +116,9 @@ public class Main { expectEquals(26, foo(a, b, 2)); expectEquals(38, foo(a, b, 3)); + int[] z = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + expectEquals(10, doit(z)); + System.out.println("passed"); } |