summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-11 09:02:04 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-11 09:02:04 +0000
commitec969ce4161538b561592a032eca6dcfaf513596 (patch)
tree8d5fbd4bacf84fae62437497b5b8a89b8f7f2ed5 /gcc/cfgloopmanip.c
parent25482c165531711569fc25c7811c5e339e54e4f5 (diff)
downloadgcc-ec969ce4161538b561592a032eca6dcfaf513596.tar.gz
2016-08-11 Richard Biener <rguenther@suse.de>
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239357 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c13
1 files changed, 9 insertions, 4 deletions
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.