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
This commit is contained in:
Richard Biener 2016-03-10 08:06:03 +00:00 committed by Richard Biener
parent ac58dca5fa
commit 3a81a5941f
5 changed files with 59 additions and 0 deletions

View 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

View 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

View File

@ -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" } } */

View File

@ -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" } } */

View 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;
}
}
}