aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-09-29 12:31:02 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-09-29 12:31:02 +0000
commit0ce1ecc7be817f0f96354b26f0d80f5bf53df764 (patch)
tree10160a742e289a4c4b2274325ea25c7de8d22d9b /gcc
parentda186c1f433028066a476955a36ce48647b13c6b (diff)
downloadgcc-0ce1ecc7be817f0f96354b26f0d80f5bf53df764.zip
gcc-0ce1ecc7be817f0f96354b26f0d80f5bf53df764.tar.gz
gcc-0ce1ecc7be817f0f96354b26f0d80f5bf53df764.tar.bz2
re PR bootstrap/77768 (LTO/PGO -O3 bootstrap broken: tree-vrp.c:11053:0: internal compiler error: Segmentation fault)
2016-09-29 Richard Biener <rguenther@suse.de> PR tree-optimization/77768 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Handle stores to readonly memory when removing redundant stores. * gcc.dg/torture/pr77768.c: New testcase. From-SVN: r240617
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr77768.c13
-rw-r--r--gcc/tree-ssa-pre.c6
4 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b832ed..26dc3f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2016-09-29 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/77768
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Handle stores to readonly memory when removing redundant stores.
+
+2016-09-29 Richard Biener <rguenther@suse.de>
+
PR middle-end/77407
* match.pd: Add X / abs (X) -> X < 0 ? -1 : 1 and
X / -X -> -1 simplifications.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9269d58..2fd9e97 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/77768
+ * gcc.dg/torture/pr77768.c: New testcase.
+
2016-09-28 Richard Biener <rguenther@suse.de>
PR middle-end/77407
diff --git a/gcc/testsuite/gcc.dg/torture/pr77768.c b/gcc/testsuite/gcc.dg/torture/pr77768.c
new file mode 100644
index 0000000..47e1484
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr77768.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+
+static const int a;
+int b;
+int *c, *d;
+int main()
+{
+ c = (int *)&a;
+ c == d ?: __builtin_exit(0);
+ for (; b; b++ >= (*d = a))
+ ;
+ return 0;
+}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 3675fb9..39bc254 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4443,9 +4443,11 @@ eliminate_dom_walker::before_dom_children (basic_block b)
&& operand_equal_p (val, rhs, 0))
{
/* We can only remove the later store if the former aliases
- at least all accesses the later one does. */
+ at least all accesses the later one does or if the store
+ was to readonly memory storing the same value. */
alias_set_type set = get_alias_set (lhs);
- if (vnresult->set == set
+ if (! vnresult
+ || vnresult->set == set
|| alias_set_subset_of (set, vnresult->set))
{
if (dump_file && (dump_flags & TDF_DETAILS))