diff options
author | 2014-06-04 12:12:08 +0100 | |
---|---|---|
committer | 2014-06-04 13:39:37 +0100 | |
commit | 7c3560f2ce0ec9484004d05a94bfaa6e02f5a96a (patch) | |
tree | 44544a733178fe7416264e064477c681f08ae562 /test/402-optimizing-control-flow/src/Main.java | |
parent | 57795db7d44bcd6d106481fa192691400b2358c8 (diff) |
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
Diffstat (limited to 'test/402-optimizing-control-flow/src/Main.java')
-rw-r--r-- | test/402-optimizing-control-flow/src/Main.java | 13 |
1 files changed, 13 insertions, 0 deletions
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; + } } |