Skip to content

Commit c6e2937

Browse files
WIP trying to repro bug
1 parent 1ea7975 commit c6e2937

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

optvm/src/test/java/com/compilerprogramming/ezlang/compiler/TestIncrementalSSA.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -725,20 +725,12 @@ public void testSSA19()
725725
String src = """
726726
func bug(N: Int)
727727
{
728-
// The main Sieve array
729-
//var ary = new [Int]{len=N,value=0}
730728
var p=2
731-
// Find primes while p^2 < N
732-
while( p*p < N ) {
733-
// skip marked non-primes
734-
//while( ary[p] ) {
735-
while (p) {
729+
while( p < N ) {
730+
if (p) {
736731
p = p + 1
737732
}
738-
p = p + 1
739733
}
740-
741-
// Now just collect the remaining primes, no more marking
742734
while ( p < N ) {
743735
p = p + 1
744736
}

optvm/src/test/java/com/compilerprogramming/ezlang/compiler/TestSSATransform.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ String compileSrc(String src) {
2424
sb.append("Before SSA\n");
2525
sb.append("==========\n");
2626
BasicBlock.toStr(sb, functionBuilder.entry, new BitSet(), false);
27+
//functionBuilder.toDot(sb,false);
2728
new EnterSSA(functionBuilder, Options.NONE);
2829
sb.append("After SSA\n");
2930
sb.append("=========\n");
3031
BasicBlock.toStr(sb, functionBuilder.entry, new BitSet(), false);
32+
//functionBuilder.toDot(sb,false);
3133
new ExitSSA(functionBuilder, Options.NONE);
3234
sb.append("After exiting SSA\n");
3335
sb.append("=================\n");
@@ -3066,20 +3068,12 @@ public void testSSA19()
30663068
String src = """
30673069
func bug(N: Int)
30683070
{
3069-
// The main Sieve array
3070-
//var ary = new [Int]{len=N,value=0}
30713071
var p=2
3072-
// Find primes while p^2 < N
3073-
while( p*p < N ) {
3074-
// skip marked non-primes
3075-
//while( ary[p] ) {
3076-
while (p) {
3072+
while( p < N ) {
3073+
if (p) {
30773074
p = p + 1
30783075
}
3079-
p = p + 1
30803076
}
3081-
3082-
// Now just collect the remaining primes, no more marking
30833077
while ( p < N ) {
30843078
p = p + 1
30853079
}

0 commit comments

Comments
 (0)