aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-isolate-paths.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-02-21 10:58:00 -0700
committerJeff Law <law@gcc.gnu.org>2017-02-21 10:58:00 -0700
commit1486c2a780bee75dc5afecdc8b03f28906b2ef04 (patch)
treee20843060c099ad84815b9aebcf3148a87cd4912 /gcc/gimple-ssa-isolate-paths.c
parent3bb4311904171b4938f6682566a24180f318b196 (diff)
downloadgcc-1486c2a780bee75dc5afecdc8b03f28906b2ef04.zip
gcc-1486c2a780bee75dc5afecdc8b03f28906b2ef04.tar.gz
gcc-1486c2a780bee75dc5afecdc8b03f28906b2ef04.tar.bz2
re PR tree-optimization/79621 (Missed path isolation opportunity)
PR tree-optimization/79621 * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior): Ignore blocks with edges to themselves. PR tree-optimization/79621 * gcc.c-torture/compile/pr79621.c: New test. From-SVN: r245637
Diffstat (limited to 'gcc/gimple-ssa-isolate-paths.c')
-rw-r--r--gcc/gimple-ssa-isolate-paths.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 25e8c8a..7babe09 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-cfg.h"
+#include "cfganal.h"
#include "intl.h"
@@ -352,6 +353,16 @@ find_implicit_erroneous_behavior (void)
if (has_abnormal_or_eh_outgoing_edge_p (bb))
continue;
+
+ /* If BB has an edge to itself, then duplication of BB below
+ could result in reallocation of BB's PHI nodes. If that happens
+ then the loop below over the PHIs would use the old PHI and
+ thus invalid information. We don't have a good way to know
+ if a PHI has been reallocated, so just avoid isolation in
+ this case. */
+ if (find_edge (bb, bb))
+ continue;
+
/* First look for a PHI which sets a pointer to NULL and which
is then dereferenced within BB. This is somewhat overly
conservative, but probably catches most of the interesting