[PATCH] options: Make -Ofast switch off -fsemantic-interposition

Martin Jambor mjambor@suse.cz
Fri Nov 19 17:55:31 GMT 2021


Hi,

On Fri, Nov 19 2021, Jan Hubicka wrote:
>> > Hi,
>> > 
>> > On Fri, Nov 12 2021, Martin Jambor wrote:
>> > > Hi,
>> > >
>> > > using -fno-semantic-interposition has been reported by various people
>> > > to bring about considerable speed up at the cost of strict compliance
>> > > to the ELF symbol interposition rules  See for example
>> > > https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
>> > >
>> > > As such I believe it should be implied by our -Ofast optimization
>> > > level, not only so that benchmarks that can benefit run faster, but
>> > > also so that people looking at -Ofast documentation for options that
>> > > could speed their programs find it.
>> > >
>> > > I have verified that with the following patch IPA-CP sees
>> > > flag_semantic_interposition set to zero at Ofast and that info and pdf
>> > > manual builds fine with the documentation change.  I am bootstrapping
>> > > and testing it now in order to comply with submission criteria but I
>> > > don't think an Ofast change gets much tested.
>> > >
>> > > Assuming it passes, is the patch OK?  (If it is, I will also add a note
>> > > about it in the "Caveats" section in gcc-12/changes.html of wwwdocs
>> > > after I commit the patch.)
>> > >
>> > 
>> > Unfortunately, I was wrong, there are testcases which use the optimize
>> > attribute to switch a function to Ofast and those ICE because
>> > -fsemantic-interposition is not an optimization flag and only
>> > optimization flags can change in an optimize attribute (AFAIK, I only
>> > had a quick glance at the results).
>> > 
>> > I am not sure what is the right way to tackle this, whether to set the
>> > flag at Ofast in some nonstandard way or make the flag an optimization
>> > flag - probably affecting function definitions, having it affect
>> > call-sites seems too fine-grained.  I will try to discuss this on IRC on
>> > Monday (and hope such change is still doable early stage3).
>> > 
>> > Sorry for posting this a bit prematurely,
>> 
>> Hi,
>> 
>> This patch turns flag_semantic_interposition to optimization option so
>> it can be enabled with per-function granuality.  This is done by adding
>> the flag among visibility flags into the symbol table.  This fixes the
>> behaviour on the testcase I added to testsuite.
>> 
>> There are bugs where get_availability misbehaves on partitioned program.
>> We can also use the new flag to fix those, but I will do that
>> incrementally.
>> 
>> The -Ofast change should be safe now.
>
> Also forgot to say it explicitly, the patch is OK, so please commit it.
>

Thanks a lot for the enabling patch.  I have committed mine after re-testing.

Martin


More information about the Gcc-patches mailing list