Disregard incoming equivalences to a path when defining a new one.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 19 Oct 2021 18:57:49 +0000 (20:57 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Fri, 22 Oct 2021 10:48:45 +0000 (12:48 +0200)
commit8a0faddadd159c19fe79572619ea6466eeed0135
tree5f151ad5046a4a3d3e5189a631afc8d76959060f
parentfe8475c500939011b90504304aec61bf6f48ac7d
Disregard incoming equivalences to a path when defining a new one.

The equivalence oracle creates a new equiv set at each def point,
killing any incoming equivalences, however in the path sensitive
oracle we create brand new equivalences at each PHI:

   BB4:

   BB8:
      x_5 = PHI <y_8(4)>

Here we note that x_5 == y_8 at the end of the path.

The current code is intersecting this new equivalence with previously
known equivalences coming into the path.  This is incorrect, as this
is a new definition.  This patch kills any known equivalence before we
register a new one.

This hasn't caused problems so far, but upcoming changes to the
pipeline has us threading more aggressively and triggering corner
cases where this causes incorrect code.

I have tested this patch with the usual regstrap cycle.  I have also
hacked a compiler comparing the old and new behavior to see if we were
previously threading paths where the decision was made due to invalid
equivalences.  Luckily, there were no such paths, but there were 22
paths in a set of .ii files where disregarding incoming relations
allowed us to thread the path.  This is a miniscule improvement,
but we moved a handful of thredable paths earlier in the pipeline,
which is always good.

Tested on x86-64 Linux.

Co-authored-by: Andrew MacLeod <amacleod@redhat.com>
gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::compute_phi_relations):
Kill any global relations we may know before registering a new
one.
* value-relation.cc (path_oracle::killing_def): New.
* value-relation.h (path_oracle::killing_def): New.
gcc/gimple-range-path.cc
gcc/value-relation.cc
gcc/value-relation.h