This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] DCE broken
- From: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- To: gcc at gcc dot gnu dot org
- Date: 27 Sep 2002 12:13:29 +0200
- Subject: [tree-ssa] DCE broken
Hello,
Still playing with the same test snippet, now with tree-ssa current CVS
int main()
{
int bla, foo, bar;
bla = 1;
foo = 2*bla;
bar = 2*bla+1;
goto waffle;
return bar;
waffle:
bla = 1;
printf("%d\n",bar);
return bar;
}
bar always has a value (3) at the end of this function, and running the
compiled program should produce the output "3" (doh!). If compiled with
-O1 -ftree-dce, there is no output.
The ".optimized" dump suggests that all expressions are killed. The
".dce" dump does not show that DCE killed them , however compiling
without the -ftree-dce flag produces the correct output. So, DCE is
broken, and the DCE dump is apparently broken too...
It almost looks as if DCE kills all *necessary* code :-)
Greetz
Steven
steven:~/gcc/play # gcc-ssa -fdump-tree-all-ssa -ftree-dce -O1 ssa-test.c
steven:~/gcc/play # cat ssa-test.c.t04.simple
main()
{
int bla;
int foo;
int bar;
int T.1;
bla = 1;
foo = bla * 2;
T.1 = bla * 2;
bar = T.1 + 1;
goto waffle;
return bar;
waffle:
bla = 1;
printf ((const char *)(char *)"%d\n", bar);
return bar;
}
steven:~/gcc/play # cat ssa-test.c.t10.dce
main
{
int bla;
int foo;
int bar;
int T.1;
bla = 1;
foo = bla * 2;
T.1 = bla * 2;
bar = T.1 + 1;
goto waffle;
return bar;
waffle:
bla = 1;
printf ((const char *)(char *)"%d\n", bar);
return bar;
}
steven:~/gcc/play # cat ssa-test.c.t11.optimized
main()
{
int bla;
int foo;
int bar;
int T.1;
goto waffle;
return bar;
waffle:
return bar;
}
steven:~/gcc/play #