Hello,

On Fri, Jan 21 2022, Aldy Hernandez via Gcc-patches wrote:
> As discussed in PR103721, the problem here is that we are crossing a
> backedge and causing us to use relations from a previous iteration of a
> loop.
>
> This handles the testcases in both PR103721 and PR104067 which are variants
> of the same thing.
>
> Tested on x86-64 Linux with the usual regstrap as well as verifying the
> thread count before and after the patch.  The number of threads is
> reduced by a miniscule amount.
>
> I assume we need release manager approval at this point?  OK for trunk?
>
> gcc/ChangeLog:
>
>       PR 103721/tree-optimization
>       * gimple-range-path.cc
>       (path_range_query::relations_may_be_invalidated): New.
>       (path_range_query::compute_ranges_in_block): Reset relations if
>       they may be invalidated.
>       (path_range_query::maybe_register_phi_relation): Exit if relations
>       may be invalidated on incoming edge.
>       (path_range_query::compute_phi_relations): Pass incoming PHI edge
>       to maybe_register_phi_relation.
>       * gimple-range-path.h (relations_may_be_invalidated): New.
>       (maybe_register_phi_relation): Pass edge instead of tree.
>       * tree-ssa-threadbackward.cc (back_threader::back_threader):
>       * value-relation.cc (path_oracle::path_oracle): Call
>       mark_dfs_back_edges.
>       (path_oracle::register_relation): Add SSA names to m_registered
>       bitmap.
>       (path_oracle::reset_path): Clear m_registered bitmap.
>       * value-relation.h (path_oracle::set_root_oracle): New.

this has caused around 5% regression of 429.mcf when built with -O2 -flto
(generic march) on x86_64 (I tried and confirmed on AMD Zen3, Zen2 and
Intel Cascadelake), the two former cases can be seen here:

https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=469.60.0
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=413.60.0&plot.1=292.60.0&;

This does not seem to be a regression against gcc11 and I am not sure
whether it is worth a bug-report, but perhaps it is worth looking at as
it may indicate where we can improve further?

Martin

Reply via email to