From 183ac6d0d295cedffd0e7971151008e9a411f345 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 11 Aug 2016 09:02:04 +0000 Subject: [PATCH] re PR tree-optimization/72772 (Missed SCEV after pass reordering@236440) 2016-08-11 Richard Biener PR tree-optimization/72772 * cfgloopmanip.c (create_preheader): Use split_edge if there is a single loop entry, avoiding degenerate PHIs. * gcc.dg/graphite/pr35356-1.c: Adjust. * gcc.dg/tree-ssa/pr59597.c: Likewise. From-SVN: r239357 --- gcc/ChangeLog | 6 ++++++ gcc/cfgloopmanip.c | 13 +++++++++---- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/graphite/pr35356-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr59597.c | 5 +++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8c65cf3e10..4984f50d51d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-08-11 Richard Biener + + PR tree-optimization/72772 + * cfgloopmanip.c (create_preheader): Use split_edge if there + is a single loop entry, avoiding degenerate PHIs. + 2016-08-11 Richard Biener * tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 20476d70459..487b91df0e5 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1497,7 +1497,7 @@ has_preds_from_loop (basic_block block, struct loop *loop) basic_block create_preheader (struct loop *loop, int flags) { - edge e, fallthru; + edge e; basic_block dummy; int nentry = 0; bool irred = false; @@ -1544,9 +1544,14 @@ create_preheader (struct loop *loop, int flags) mfb_kj_edge = loop_latch_edge (loop); latch_edge_was_fallthru = (mfb_kj_edge->flags & EDGE_FALLTHRU) != 0; - fallthru = make_forwarder_block (loop->header, mfb_keep_just, NULL); - dummy = fallthru->src; - loop->header = fallthru->dest; + if (nentry == 1) + dummy = split_edge (single_entry); + else + { + edge fallthru = make_forwarder_block (loop->header, mfb_keep_just, NULL); + dummy = fallthru->src; + loop->header = fallthru->dest; + } /* Try to be clever in placing the newly created preheader. The idea is to avoid breaking any "fallthruness" relationship between blocks. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7bca99a8b3b..00cdc8f6ae0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-08-11 Richard Biener + + PR tree-optimization/72772 + * gcc.dg/graphite/pr35356-1.c: Adjust. + * gcc.dg/tree-ssa/pr59597.c: Likewise. + 2016-08-11 Janne Blomqvist * gfortran.dg/random_7.f90: Take into account that the last seed diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c index 649302b049e..9b633d27a37 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c @@ -34,4 +34,4 @@ if (n >= k + 1 && k >= 0) { */ -/* { dg-final { scan-tree-dump "if \\\(P_9 >= P_10 \\\+ 1 && P_10 >= 0\\\) \\\{" "graphite" } } */ +/* { dg-final { scan-tree-dump "if \\\(P_8 >= P_9 \\\+ 1 && P_9 >= 0\\\) \\\{" "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c b/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c index b7760167f04..4ac12c8c15c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c @@ -54,5 +54,6 @@ main (int argc, char argv[]) return crc; } -/* { dg-final { scan-tree-dump "Cancelling" "vrp1" } } */ - +/* { dg-final { scan-tree-dump-times "Registering jump thread" 3 "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "joiner" "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */ -- 2.30.2