aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-03-10 08:06:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-03-10 08:06:03 +0000
commit3a81a5941f88c3774e4b337ab275cd6c25508124 (patch)
tree23ea3926bf705306c1527d09670ca40e467760b8 /gcc
parentac58dca5fa7ae3a1b97a612a26208cf566fdbeef (diff)
downloadgcc-3a81a5941f88c3774e4b337ab275cd6c25508124.zip
gcc-3a81a5941f88c3774e4b337ab275cd6c25508124.tar.gz
gcc-3a81a5941f88c3774e4b337ab275cd6c25508124.tar.bz2
re PR tree-optimization/70128 (Linux kernel div patching optimized away)
2016-03-10 Richard Biener <rguenther@suse.de> PR tree-optimization/70128 * tree-ssa-structalias.c (set_uids_in_ptset): Set vars_contains_nonlocal for any FUNCTION_DECL or LABEL_DECL. * gcc.dg/tree-ssa/alias-34.c: New testcase. * gcc.dg/tree-ssa/alias-35.c: Likewise. From-SVN: r234099
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/alias-34.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/alias-35.c18
-rw-r--r--gcc/tree-ssa-structalias.c10
5 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a35884f..54f04b0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70128
+ * tree-ssa-structalias.c (set_uids_in_ptset): Set
+ vars_contains_nonlocal for any FUNCTION_DECL or LABEL_DECL.
+
2016-03-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/70152
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eec10fd..8ee83bc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70128
+ * gcc.dg/tree-ssa/alias-34.c: New testcase.
+ * gcc.dg/tree-ssa/alias-35.c: Likewise.
+
2016-03-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/70152
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-34.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-34.c
new file mode 100644
index 0000000..5738fea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-34.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-optimized" } */
+
+void foo (int b)
+{
+ void *p;
+lab:
+ if (b)
+ p = &&lab;
+ else
+ {
+lab2:
+ p = &&lab2;
+ }
+ *(char *)p = 1;
+}
+
+/* We should keep the store to the label locations. */
+/* { dg-final { scan-tree-dump " = 1;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-35.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-35.c
new file mode 100644
index 0000000..1ea2988
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-35.c
@@ -0,0 +1,18 @@
+/* PR70128 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-optimized" } */
+
+void foo (int b)
+{
+ extern void bar (void);
+ extern void baz (void);
+ void *p;
+ if (b)
+ p = bar;
+ else
+ p = baz;
+ *(char *)p = 1;
+}
+
+/* We should keep the store to the function locations. */
+/* { dg-final { scan-tree-dump " = 1;" "optimized" } } */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index de12380..bad1ea1 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6280,6 +6280,16 @@ set_uids_in_ptset (bitmap into, bitmap from, struct pt_solution *pt,
&& ! auto_var_in_fn_p (vi->decl, fndecl)))
pt->vars_contains_nonlocal = true;
}
+
+ else if (TREE_CODE (vi->decl) == FUNCTION_DECL
+ || TREE_CODE (vi->decl) == LABEL_DECL)
+ {
+ /* Nothing should read/write from/to code so we can
+ save bits by not including them in the points-to bitmaps.
+ Still mark the points-to set as containing global memory
+ to make code-patching possible - see PR70128. */
+ pt->vars_contains_nonlocal = true;
+ }
}
}