Don't run DSE at -Og

Richard Sandiford richard.sandiford@arm.com
Mon Jul 8 14:27:00 GMT 2019


Richard Biener <richard.guenther@gmail.com> writes:
> On Sun, Jul 7, 2019 at 9:04 PM Jeff Law <law@redhat.com> wrote:
>>
>> On 7/7/19 3:43 AM, Richard Sandiford wrote:
>> > This patch stops gimple and rtl DSE from running by default at -Og.
>> > The idea is both to improve compile time and to stop us from deleting
>> > stores that we can't track in debug info.
>> >
>> > We could rein this back in future for stores to local variables
>> > with is_gimple_reg_type, but at the moment we don't have any
>> > infrastructure for switching between binds to specific values
>> > and binds to evolving memory locations.  Even then, location
>> > tracking only works for direct references to the variables, and doesn't
>> > for example help with printing dereferenced pointers (see the next patch
>> > in the series for an example).
>> >
>> > I'm also not sure that DSE is important enough for -Og to justify the
>> > compile time cost -- especially in the case of RTL DSE, which is pretty
>> > expensive.
>> >
>> > Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?
>> >
>> > Richard
>> >
>> >
>> > 2019-07-07  Richard Sandiford  <richard.sandiford@arm.com>
>> >
>> > gcc/
>> >       * common.opt (Og): Change the initial value of flag_dse to 0.
>> >       * opts.c (default_options_table): Move OPT_ftree_dse from
>> >       OPT_LEVELS_1_PLUS to OPT_LEVELS_1_PLUS_NOT_DEBUG.  Also add
>> >       OPT_fdse to OPT_LEVELS_1_PLUS_NOT_DEBUG.  Put the OPT_ftree_pta
>> >       entry before the OPT_ftree_sra entry.
>> >       * doc/invoke.texi (Og): Add -fdse and -ftree-dse to the list
>> >       of flags disabled by Og.
>> >
>> > gcc/testsuite/
>> >       * c-c++-common/guality/Og-global-dse-1.c: New test.
>> OK.  I doubt DSE is at all important if someone has asked for Og.
>
> Hmm.  -Og also asks for runtime performance.  Can we instead restrict
> DSE to artificial decls?  I also fear that this leaves a _lot_ of abstraction
> for C++ code given we also do not run SRA with -Og even though that
> has means to preserve debug info.

Following up your question in the other patch: I see a 2.5% slowdown for
cc1plus bulit at -Og when compiling tree-into-ssa.ii at -O2 -g.  I think
it mostly comes from removing RTL DSE.  I get a very similar slowdown with
gimple DSE reenabled.

There again, we're not very C++-heavy, so cc1plus might not be a good
test for that.

Richard



More information about the Gcc-patches mailing list