Hi!
I have code with dead function calls which are not removed. Is it possible
to mark functions that have no side effects (e.g. sin() or floor() ) so that they
are removed by dead code elimination?
-Jochen
Hi!
I have code with dead function calls which are not removed. Is it possible
to mark functions that have no side effects (e.g. sin() or floor() ) so that they
are removed by dead code elimination?
-Jochen
Yep, just add the readonly/readnone attributes to the call site or function and they should be deleted if dead. See LangRef.html for more info.
-Chris
Yep, just add the readonly/readnone attributes to the call site or function and they should be deleted if dead. See LangRef.html for more info.
Is it even possible to define this attribute in clang?
e.g. __attribute__(readnone) float sin(float x);
-Jochen
Is it even possible to define this attribute in clang?
e.g. __attribute__(readnone) float sin(float x);
The corresponding gcc/clang attribute names are "const" and "pure".