This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH] Change default to -fcommon


On 11/20/2017 10:34 AM, Michael Matz wrote:
What's your rationale for changing this?  In your initial mail you said:

"On many targets this means global variable accesses having an unnecessary
codesize and performance penalty in C code (the same source generates
better code when built as C++)."

I have a hard time imaging that, so can you give details?  FWIW I've
personally always considered using common symbols nicer.

The optimization case I'm familiar with is for targets that support -G and GP-relative addressing modes to address small data. Generally you can only do that if the variable is allocated in the same compilation unit as the reference, so the compiler knows definitely where it's placed (unless the backend also supports some other mechanism for asserting that a variable is small data). Putting tentatively-defined variables in common defeats that optimization.

-Sandra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]