re PR tree-optimization/47286 (Invalid code when using register ... asm)

2011-01-14  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47286
	* tree-ssa-structalias.c (new_var_info): Register variables
	are global.

	* gcc.dg/tree-ssa/pr47286.c: New testcase.

From-SVN: r168779
This commit is contained in:
Richard Guenther 2011-01-14 12:15:43 +00:00 committed by Richard Biener
parent db09f9434d
commit 6c0c92e6b3
4 changed files with 35 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47286
* tree-ssa-structalias.c (new_var_info): Register variables
are global.
2011-01-14 Martin Jambor <mjambor@suse.cz>
PR middle-end/46823

View File

@ -1,3 +1,8 @@
2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47286
* gcc.dg/tree-ssa/pr47286.c: New testcase.
2011-01-13 Kai Tietz <kai.tietz@onevision.com>
PR c++/47213

View File

@ -0,0 +1,20 @@
/* { dg-do compile } */
/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct thread_info { int preempt_count; };
static inline struct thread_info *current_thread_info(void)
{
register struct thread_info *sp asm("esp");
return sp;
}
void testcase(void)
{
current_thread_info()->preempt_count += 1;
}
/* We have to make sure that alias analysis treats sp as pointing
to globals and thus the store not optimized away. */
/* { dg-final { scan-tree-dump "->preempt_count =" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */

View File

@ -413,7 +413,10 @@ new_var_info (tree t, const char *name)
ret->is_global_var = (t == NULL_TREE);
ret->is_fn_info = false;
if (t && DECL_P (t))
ret->is_global_var = is_global_var (t);
ret->is_global_var = (is_global_var (t)
/* We have to treat even local register variables
as escape points. */
|| (TREE_CODE (t) == VAR_DECL && DECL_REGISTER (t)));
ret->solution = BITMAP_ALLOC (&pta_obstack);
ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
ret->next = NULL;