This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [RFC][PATCH] Change default to -fcommon
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>,Michael Matz <matz at suse dot de>,Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>,"ebotcazou at adacore dot com" <ebotcazou at adacore dot com>,GCC Patches <gcc-patches at gcc dot gnu dot org>,nd <nd at arm dot com>
- Date: Mon, 20 Nov 2017 21:58:08 +0100
- Subject: Re: [RFC][PATCH] Change default to -fcommon
- Authentication-results: sourceware.org; auth=none
- References: <DB6PR0801MB20537CD32063175699A3E50F832F0@DB6PR0801MB2053.eurprd08.prod.outlook.com> <839cf67b-dee2-7ee7-e59e-3315cbc6cece@codesourcery.com> <CAFiYyc1nHMX73evvnCcF1x0SeP7=p72VOinfw3oyaak-d2TanA@mail.gmail.com> <DB6PR0801MB2053E05E8489867CFC86DF2E83220@DB6PR0801MB2053.eurprd08.prod.outlook.com> <alpine.LSU.2.21.1711201827190.25295@wotan.suse.de> <c35b7130-90a7-07d5-bf6f-45b13b90bcf2@codesourcery.com>
On November 20, 2017 9:02:55 PM GMT+01:00, Sandra Loosemore <sandra@codesourcery.com> wrote:
>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.
Also we cannot raise alignment of commons and thus vectorization is pessimized (all vectorizer testcases use - fno-common).
IIRC LTO promotes commons to locals.
Richard.
>-Sandra