aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-03-28 13:57:43 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-03-28 13:57:43 +0000
commitea7d7da886911a91831bd45fc56d0aa1e2a55ecc (patch)
tree32c6fd2b62e696ad32a428181f47685729b004a6 /gcc
parent498173ef330d33ca0df09bfc3481de6d56cfa64c (diff)
downloadgcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.zip
gcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.tar.gz
gcc-ea7d7da886911a91831bd45fc56d0aa1e2a55ecc.tar.bz2
re PR ipa/78644 (ICE: SIGSEGV in is_gimple_reg_type with -Og -fipa-cp)
2017-03-28 Richard Biener <rguenther@suse.de> PR tree-optimization/78644 * tree-ssa-ccp.c (evaluate_stmt): When we may not use the value of a simplification result we may not use it at all. * gcc.dg/pr78644-1.c: New testcase. * gcc.dg/pr78644-2.c: Likewise. From-SVN: r246534
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/pr78644-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr78644-2.c20
-rw-r--r--gcc/tree-ssa-ccp.c22
5 files changed, 67 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f15a8a8..df90159 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2017-03-28 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/78644
+ * tree-ssa-ccp.c (evaluate_stmt): When we may not use the value
+ of a simplification result we may not use it at all.
+
+2017-03-28 Richard Biener <rguenther@suse.de>
+
PR ipa/80205
* tree-inline.c (copy_phis_for_bb): Do not create PHI node
without arguments, generate default definition of a SSA name.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7b3f01..0c0281e5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/78644
+ * gcc.dg/pr78644-1.c: New testcase.
+ * gcc.dg/pr78644-2.c: Likewise.
+
2017-03-28 Toma Tabacu <toma.tabacu@imgtec.com>
* gcc.dg/pic-3.c: Skip for mips*-*-linux-*.
diff --git a/gcc/testsuite/gcc.dg/pr78644-1.c b/gcc/testsuite/gcc.dg/pr78644-1.c
new file mode 100644
index 0000000..d6aafeb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78644-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Og -fipa-cp -w -Wno-psabi" } */
+
+typedef unsigned __int128 u128;
+typedef unsigned __int128 V __attribute__ ((vector_size (64)));
+
+V x4;
+
+static V
+bar (u128 x2, u128 x3)
+{
+ while (x4[0]--)
+ x2 /= x3 >>= 1;
+ return x2 + x3 + x4;
+}
+
+void
+foo (void)
+{
+ bar (0, 0);
+}
diff --git a/gcc/testsuite/gcc.dg/pr78644-2.c b/gcc/testsuite/gcc.dg/pr78644-2.c
new file mode 100644
index 0000000..3395dde
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78644-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Og -finline-functions-called-once -w -Wno-psabi" } */
+
+typedef unsigned V __attribute__ ((vector_size (64)));
+typedef unsigned __int128 U __attribute__ ((vector_size (64)));
+
+U
+bar4 (U u0, U u1)
+{
+ if (u1[0])
+ u1 <<= 1;
+ return u0 + u1;
+}
+
+V
+foo (U u, V v)
+{
+ v |= (unsigned)bar4(u, (U){})[0];
+ return v;
+}
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 023018c..23f2adcb 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1749,18 +1749,24 @@ evaluate_stmt (gimple *stmt)
fold_defer_overflow_warnings ();
simplified = ccp_fold (stmt);
if (simplified
- && TREE_CODE (simplified) == SSA_NAME
+ && TREE_CODE (simplified) == SSA_NAME)
+ {
/* We may not use values of something that may be simulated again,
see valueize_op_1. */
- && (SSA_NAME_IS_DEFAULT_DEF (simplified)
- || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (simplified))))
- {
- ccp_prop_value_t *val = get_value (simplified);
- if (val && val->lattice_val != VARYING)
+ if (SSA_NAME_IS_DEFAULT_DEF (simplified)
+ || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (simplified)))
{
- fold_undefer_overflow_warnings (true, stmt, 0);
- return *val;
+ ccp_prop_value_t *val = get_value (simplified);
+ if (val && val->lattice_val != VARYING)
+ {
+ fold_undefer_overflow_warnings (true, stmt, 0);
+ return *val;
+ }
}
+ else
+ /* We may also not place a non-valueized copy in the lattice
+ as that might become stale if we never re-visit this stmt. */
+ simplified = NULL_TREE;
}
is_constant = simplified && is_gimple_min_invariant (simplified);
fold_undefer_overflow_warnings (is_constant, stmt, 0);