[LLVMdev] Why the optimizer removes unused "volatile" globals?
Eli Friedman
eli.friedman at gmail.com
Sat Jul 11 09:57:25 PDT 2009
On Sat, Jul 11, 2009 at 9:27 AM, Sanjiv Gupta<sanjiv.gupta at microchip.com> wrote:
> PIC16 does not want globals marked with section attributes being
> deleted. But I see llvm-ld removes them even if the user marks them as
> "volatile".I wonder why?
If there aren't any references to a global with internal linkage, it's
assumed to be unused, and deleted. Try taking a look at the generated
code when __attribute__((used)) is applied to a global. (volatile is
irrelevant here.)
-Eli
More information about the llvm-dev
mailing list