diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java b/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java index 796b495e0..58f179787 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java @@ -34,9 +34,7 @@ public class Pass2LoopHeadConstantIdentification extends Pass2SsaOptimization { for(NaturalLoop loop : loopSet.getLoops()) { LabelRef loopHeadRef = loop.getHead(); ControlFlowBlock loopHeadBlock = getGraph().getBlock(loopHeadRef); - //TODO: Fix remaining errors! - //boolean modified = optimizeLoopHead(loopHeadBlock, loop, variableReferenceInfos); - boolean modified = false; + boolean modified = optimizeLoopHead(loopHeadBlock, loop, variableReferenceInfos); if(modified) { getProgram().clearStatementInfos(); getProgram().clearLoopSet(); diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 25409372b..c50a7f03e 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -1952,8 +1952,8 @@ public class TestPrograms { } @Test - public void testBoolIfs() throws IOException, URISyntaxException { - compileAndCompare("bool-ifs"); + public void testBoolIfsMin() throws IOException, URISyntaxException { + compileAndCompare("bool-ifs-min"); } @Test diff --git a/src/test/kc/bool-ifs-min.kc b/src/test/kc/bool-ifs-min.kc new file mode 100644 index 000000000..b5ee3cc2a --- /dev/null +++ b/src/test/kc/bool-ifs-min.kc @@ -0,0 +1,12 @@ +// A test of boolean conditions using && || and ! + +void main() { + const char* screen = 0x400; + for( char i : 0..20) { + if( (i<10) && ((i&1)==0) ) { + screen[i] = '*'; + } + } +} + +