1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-03 12:07:26 +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()) {
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();

View File

@ -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

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