[PATCH] Don't localize globals that may serve as leak checker roots.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Sep 26 09:41:02 PDT 2013


> IMO moving globals to locals in main is basically a SPEC benchmark hack.
> It's only profitable when most of the program can be inlined into main and
> the globals become register allocated.
>
> The C++ standard sez [basic.start.main]p6: "The function main shall not be
> used (3.2) within a program."  The C standard has no such language, so this
> optimization isn't really valid for C.  IIRC this caused PNaCl some
> problems.
>
> So if we want to remove this optimization, it should be on *that* basis, and
> not because we want leak checking to work out of the box.

Good point.

Alexey, would you be ok with starting a new thread with a patch to
remove this optimization completely?

Cheers,
Rafael



More information about the llvm-commits mailing list