1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-01 00:51:12 +00:00

Added bool-ifs-min test demonstrating problem with constant loop head optimization

This commit is contained in:
jespergravgaard 2019-08-06 09:08:10 +02:00
parent e167f8dce8
commit 50b59555fc
3 changed files with 15 additions and 5 deletions

View File

@ -34,9 +34,7 @@ public class Pass2LoopHeadConstantIdentification extends Pass2SsaOptimization {
for(NaturalLoop loop : loopSet.getLoops()) { for(NaturalLoop loop : loopSet.getLoops()) {
LabelRef loopHeadRef = loop.getHead(); LabelRef loopHeadRef = loop.getHead();
ControlFlowBlock loopHeadBlock = getGraph().getBlock(loopHeadRef); ControlFlowBlock loopHeadBlock = getGraph().getBlock(loopHeadRef);
//TODO: Fix remaining errors! boolean modified = optimizeLoopHead(loopHeadBlock, loop, variableReferenceInfos);
//boolean modified = optimizeLoopHead(loopHeadBlock, loop, variableReferenceInfos);
boolean modified = false;
if(modified) { if(modified) {
getProgram().clearStatementInfos(); getProgram().clearStatementInfos();
getProgram().clearLoopSet(); getProgram().clearLoopSet();

View File

@ -1952,8 +1952,8 @@ public class TestPrograms {
} }
@Test @Test
public void testBoolIfs() throws IOException, URISyntaxException { public void testBoolIfsMin() throws IOException, URISyntaxException {
compileAndCompare("bool-ifs"); compileAndCompare("bool-ifs-min");
} }
@Test @Test

View File

@ -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] = '*';
}
}
}