]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/70128 (Linux kernel div patching optimized away)
authorRichard Biener <rguenther@suse.de>
Thu, 10 Mar 2016 08:06:03 +0000 (08:06 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 10 Mar 2016 08:06:03 +0000 (08:06 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/alias-34.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/alias-35.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index a35884fffddbaf667a3e0889b6c1771f1b9a4356..54f04b046dd277044729a55870d632026c3feacf 100644 (file)
@@ -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
index eec10fd50013603f0bc69ec192a32039d24975c5..8ee83bcadbf33ac9f3ffcda47036a418ca5c4f13 100644 (file)
@@ -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 (file)
index 0000000..5738fea
--- /dev/null
@@ -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 (file)
index 0000000..1ea2988
--- /dev/null
@@ -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" } } */
index de123800f0b31403848cf91aac88d52749fdca72..bad1ea12a7f9610aa3d27889de43adcd3bbac08c 100644 (file)
@@ -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;
+       }
     }
 }