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:
parent
e167f8dce8
commit
50b59555fc
@ -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();
|
||||||
|
@ -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
|
||||||
|
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