From b1668acb81d27e9e4e33ad4920bfba1449413c64 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Fri, 19 Jun 2015 09:07:25 +0000 Subject: [PATCH] tree-chkp.c (chkp_compute_bounds_for_assignment): Don't reuse bounds created for abnormal ssa names. gcc/ * tree-chkp.c (chkp_compute_bounds_for_assignment): Don't reuse bounds created for abnormal ssa names. gcc/testsuite/ * gcc.target/i386/mpx/pr66581.c: New test. From-SVN: r224643 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/tree-chkp.c | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb37d086aee..e567ed0db71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-19 Ilya Enkovich + + * tree-chkp.c (chkp_compute_bounds_for_assignment): Don't + reuse bounds created for abnormal ssa names. + 2015-06-19 Jakub Jelinek * config/nvptx/nvptx.md (allocate_stack): Rename to... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a3978b7e79..1ca4b686ddc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-06-19 Ilya Enkovich + + * gcc.target/i386/mpx/pr66581.c: New test. + 2015-06-18 Uros Bizjak * gcc.target/i386/cmov9.c: New test. diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 7ffec7b6305..4c3317af3e0 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -2526,6 +2526,7 @@ chkp_compute_bounds_for_assignment (tree node, gimple assign) tree rhs1 = gimple_assign_rhs1 (assign); tree bounds = NULL_TREE; gimple_stmt_iterator iter = gsi_for_stmt (assign); + tree base = NULL; if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -2552,6 +2553,7 @@ chkp_compute_bounds_for_assignment (tree node, gimple assign) case INTEGER_CST: /* Bounds are just propagated from RHS. */ bounds = chkp_find_bounds (rhs1, &iter); + base = rhs1; break; case VIEW_CONVERT_EXPR: @@ -2622,6 +2624,8 @@ chkp_compute_bounds_for_assignment (tree node, gimple assign) (e.g. pointer minus pointer). In such case use default invalid op bounds. */ bounds = chkp_get_invalid_op_bounds (); + + base = (bounds == bnd1) ? rhs1 : (bounds == bnd2) ? rhs2 : NULL; } break; @@ -2717,6 +2721,19 @@ chkp_compute_bounds_for_assignment (tree node, gimple assign) gcc_assert (bounds); + /* We may reuse bounds of other pointer we copy/modify. But it is not + allowed for abnormal ssa names. If we produced a pointer using + abnormal ssa name, we better make a bounds copy to avoid coalescing + issues. */ + if (base + && TREE_CODE (base) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (base)) + { + gimple stmt = gimple_build_assign (chkp_get_tmp_reg (NULL), bounds); + gsi_insert_after (&iter, stmt, GSI_SAME_STMT); + bounds = gimple_assign_lhs (stmt); + } + if (node) bounds = chkp_maybe_copy_and_register_bounds (node, bounds); -- 2.30.2