mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-30 09:50:13 +00:00
Added bool-ifs-min test demonstrating problem with constant loop head optimization
This commit is contained in:
parent
e167f8dce8
commit
50b59555fc
@ -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();
|
||||
|
@ -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
|
||||
|
12
src/test/kc/bool-ifs-min.kc
Normal file
12
src/test/kc/bool-ifs-min.kc
Normal 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] = '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user