Rainer Deyke: > Of course, a good optimizer can still reorder the declarations in this > case, or even eliminate the whole function body (since it doesn't do > anything).
LLVM has a good optimizer. If you try the LLVM demo on C code with LTO activated: http://llvm.org/demo/index.cgi This C code: void bar(int foo) { int a; int c = 3; if (foo) { a = 1; } else { a = 2; } } Produces an useful warining: /tmp/webcompile/_16254_0.c:3: warning: unused variable 'c' And an empty function: define void @bar(i32 %foo) nounwind readnone { entry: ret void } Bye, bearophile
