From 7ad97d17775832ca57166a8bf302f48ea07a785e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 31 Jan 2019 11:51:59 +0000 Subject: [PATCH] re PR tree-optimization/89135 (internal compiler error: in gimple_split_edge, at tree-cfg.c:2747) 2019-01-31 Richard Biener PR tree-optimization/89135 * tree-ssa-phiprop.c (pass_phiprop::execute): Skip blocks with abnormal preds. * gcc.dg/torture/pr89135.c: New testcase. From-SVN: r268417 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/torture/pr89135.c | 33 ++++++++++++++++++++++++++ gcc/tree-ssa-phiprop.c | 10 ++++++-- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr89135.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a220d575600..d0ce1170b17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-31 Richard Biener + + PR tree-optimization/89135 + * tree-ssa-phiprop.c (pass_phiprop::execute): Skip blocks + with abnormal preds. + 2019-01-31 Jakub Jelinek PR sanitizer/89124 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48f4bbddd88..5197926d3d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-31 Richard Biener + + PR tree-optimization/89135 + * gcc.dg/torture/pr89135.c: New testcase. + 2019-01-31 Jakub Jelinek PR sanitizer/89124 diff --git a/gcc/testsuite/gcc.dg/torture/pr89135.c b/gcc/testsuite/gcc.dg/torture/pr89135.c new file mode 100644 index 00000000000..8a93e8983df --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89135.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ + +typedef __INTPTR_TYPE__ intptr_t; +intptr_t a, b, c, d; +int foo (void) { return 0; } +int baz (void); + +void +bar (void) +{ + intptr_t g = (intptr_t) &&h; + void *i = &&j, *k = &&l; +j: + if (baz ()) + { + intptr_t **n = (intptr_t **) &a; +l: + b = 0; + for (; b >= 0;) + goto *k; +h: + **n = 0; + for (;;) + { + intptr_t *o = &c; + g = foo (); + *o = g; + if (c) + goto *d; + } + } + goto *i; +} diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index cad1d217ee7..d710582a915 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -495,8 +495,14 @@ pass_phiprop::execute (function *fun) bbs = get_all_dominated_blocks (CDI_DOMINATORS, single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun))); FOR_EACH_VEC_ELT (bbs, i, bb) - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - did_something |= propagate_with_phi (bb, gsi.phi (), phivn, n); + { + /* Since we're going to move dereferences across predecessor + edges avoid blocks with abnormal predecessors. */ + if (bb_has_abnormal_pred (bb)) + continue; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + did_something |= propagate_with_phi (bb, gsi.phi (), phivn, n); + } if (did_something) gsi_commit_edge_inserts (); -- 2.30.2