[LLVMdev] DCE and external function

Duncan Sands baldrick at free.fr
Tue Oct 12 05:05:37 PDT 2010


>> only if the compiler can prove that the called function has
>> no side effects (such as modifying some global variables or
>> causing the program to exit).
>
> can it prove if the function resides in a shared library?

No, however it can prove it if the function is in a static library consisting
of bitcode files (what you get if you compile with -emit-llvm) and you do
link-time optimization.  However it's probably simpler to declare the function
as having no side-effects using gcc's "pure" or "const" attribute.

Ciao,

Duncan.



More information about the llvm-dev mailing list