diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2017-09-29 14:55:14 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2017-09-29 14:55:14 +0000 |
commit | e75210d645630f12bf149043cf6ae51829f5ed78 (patch) | |
tree | b21573fe18781df592cfb303930614cf91d73b5f /gcc | |
parent | eafa7a907b88719f2cb6cfa8addd5accf55310e5 (diff) | |
download | gcc-e75210d645630f12bf149043cf6ae51829f5ed78.zip gcc-e75210d645630f12bf149043cf6ae51829f5ed78.tar.gz gcc-e75210d645630f12bf149043cf6ae51829f5ed78.tar.bz2 |
re PR tree-optimization/82337 (ICE: SSA corruption at tree-ssa-coalesce.c:1010)
[gcc]
2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/82337
* gimple-ssa-strength-reduction.c (find_phi_def): Don't record a
phi definition if the PHI result appears in an abnormal PHI.
(find_basis_for_base_expr): Don't record a basis if the LHS of the
basis appears in an abnormal PHI.
[gcc]
2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/82337
* gcc.c-torture/compile/pr82337.c: New file.
From-SVN: r253293
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr82337.c | 25 |
4 files changed, 45 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6212c8..63fbd59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/82337 + * gimple-ssa-strength-reduction.c (find_phi_def): Don't record a + phi definition if the PHI result appears in an abnormal PHI. + (find_basis_for_base_expr): Don't record a basis if the LHS of the + basis appears in an abnormal PHI. + 2017-09-29 Richard Biener <rguenther@suse.de> * graphite-isl-ast-to-gimple.c diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index b37ce35..42320ff 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -488,7 +488,8 @@ find_phi_def (tree base) c = base_cand_from_table (base); - if (!c || c->kind != CAND_PHI) + if (!c || c->kind != CAND_PHI + || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_phi_result (c->cand_stmt))) return 0; return c->cand_num; @@ -557,6 +558,11 @@ find_basis_for_base_expr (slsr_cand_t c, tree base_expr) gimple_bb (one_basis->cand_stmt))) continue; + tree lhs = gimple_assign_lhs (one_basis->cand_stmt); + if (lhs && TREE_CODE (lhs) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) + continue; + if (!basis || basis->cand_num < one_basis->cand_num) basis = one_basis; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4cca060..5bb4a2f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/82337 + * gcc.c-torture/compile/pr82337.c: New file. + 2017-09-29 Javier Miranda <miranda@adacore.com> * gnat.dg/unchecked_union3.adb: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82337.c b/gcc/testsuite/gcc.c-torture/compile/pr82337.c new file mode 100644 index 0000000..f8afa74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr82337.c @@ -0,0 +1,25 @@ +/* PR82337: SLSR needs to prevent abnormal SSA names from + serving as a basis. */ +char *a, *b, *c; + +struct d { + short e; + char f[]; +}; + +extern void j (void); + +void +g() { + struct d *h; + char *i; + int d; + do { + i = h->f + d; + 20 ? j() : 0; + i = c; + if (__builtin_setjmp (h)) + b = h->f + d; + d = (int)(*i); + } while (a); +} |