From 7c3560f2ce0ec9484004d05a94bfaa6e02f5a96a Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 4 Jun 2014 12:12:08 +0100 Subject: Fix a bug in SSA construction. If a join block does not have an incoming value for a local from a predecessor block, we should not create a phi. The verifier has made sure the local is updated before any following reads after this block. Change-Id: Id2785efc73c9fb3224826fff2f4b4ad215905ff4 --- test/402-optimizing-control-flow/src/Main.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/402-optimizing-control-flow/src/Main.java') diff --git a/test/402-optimizing-control-flow/src/Main.java b/test/402-optimizing-control-flow/src/Main.java index 3339ef436e..c9c24dd568 100644 --- a/test/402-optimizing-control-flow/src/Main.java +++ b/test/402-optimizing-control-flow/src/Main.java @@ -40,6 +40,9 @@ public class Main { result = $opt$testForLoop(42); expectEquals(44, result); + + result = $opt$testIfWithLocal(5); + expectEquals(7, result); } static int $opt$testIfEq1(int a) { @@ -73,4 +76,14 @@ public class Main { for (; a != 44; a++) {} return a; } + + static int $opt$testIfWithLocal(int a) { + if (a == 5) { + int f = 2; + a += f; + } + // The SSA builder should not create a phi for f. + + return a; + } } -- cgit v1.2.3-59-g8ed1b