[cfe-dev] On preserving unused file-local definitions at -O0

Robinson, Paul Paul_Robinson at playstation.sony.com
Fri Apr 11 09:42:53 PDT 2014


> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
> On Behalf Of David Blaikie
> Sent: Friday, April 11, 2014 8:59 AM
> To: cfe-dev Developers; Eric Christopher
> Subject: [cfe-dev] On preserving unused file-local definitions at -O0
> 
> Clang fails a bunch of the GDB testsuite because clang optimizes* away
> file-local (namespace scope static) functions and variables at -O0.
> 
> I sent a patch to the GDB mailing list to 'fix' these tests by using
> non-static functions/variables, or marking them used with
> __attribute__((used)). While there's precedent for both, I've had one
> reply pushing back a little that Clang should change behavior here and
> produce code for these unused definitions.
> 
> Before I go back to the GDB mailing list and say that Clang will not
> change its behavior here, I figured I'd just put it out there and ask.
> If it comes to it I can file a bug, resolve it as "won't fix"/"by
> design"/"invalid", and then mark these GDB tests as KFAIL against that
> bug if the two communities can't come to an agreement about the
> correct behavior here.
> 
> It's only been hours since I posted to GDB so the opinion expressed
> isn't the only one or necessarily the will of the GDB community, but I
> wanted to cover all my bases by having the conversation here too
> before I go representing the Clang community opinion over there.
> 
> For myself I think there's some merit to this and realize there's
> continuous tension between -O0 used for debugging ("don't make my code
> hard to debug") and -O0 used for JIT or similar situations ("give me
> code as quickly as possible"). At some point these things may need to
> be split (-Og or some other approach) I would guess, though so long as
> Clang's -O0 leans towards "give me code quickly" we'll need to do
> something about the GDB tests that assume -O0 for debugging fidelity.
> 
> * it's a very cheap optimization - in the sense that we just don't do
> any IRGen for them because we see they're unreferenced

For Clang, run the GDB suite with -femit_all_decls ?
--paulr

> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev






More information about the cfe-dev mailing list