diff options
author | wschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-02 18:07:45 +0000 |
---|---|---|
committer | wschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-02 18:07:45 +0000 |
commit | 1e58ee6ffff15c24ba34ec033d61b7f083b47f2f (patch) | |
tree | 695bb17186e7fd5cc8ea4ecc2b79ad0ab0154089 | |
parent | 4db7352aa2dabf8ed7ab11f1c79f6e4fd4f86709 (diff) |
[gcc]
2017-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
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-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/82337
* gcc.c-torture/compile/pr82337.c: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253359 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr82337.c | 25 |
4 files changed, 51 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc494c6d9980..2191d625ad96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2017-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 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-30 Jakub Jelinek <jakub@redhat.com> * config/i386/i386.c (ix86_split_idivmod): Use mode instead of diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index c28a17ba3f08..2c67d97b28f5 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -476,7 +476,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; @@ -515,6 +516,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 980a02e217ac..86e1d6a41707 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/82337 + * gcc.c-torture/compile/pr82337.c: New file. + 2017-09-30 Jakub Jelinek <jakub@redhat.com> Backported from mainline 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 000000000000..f8afa746adba --- /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); +} |