re PR tree-optimization/29877 (out of SSA (TER) extends variable life of variable beyond original declared)

PR tree-optimization/29877
	gcc/
	* tree-ssa-ter.c (is_replaceable_p): Deem assignments with
	a register variable on the RHS to not be replaceable.

	gcc/testsuite/
	* gcc.dg/pr16194.c: Skip test entirely if we don't know the
	name of a hard register for the target concerned.  Adjust dg-error
	directives to cope with new behaviour of TER.

From-SVN: r120571
This commit is contained in:
Mark Shinwell 2007-01-08 08:33:42 +00:00 committed by Mark Shinwell
parent 99fc25020d
commit 46e3b90f7e
4 changed files with 39 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2007-01-08 Mark Shinwell <shinwell@codesourcery.com>
PR tree-optimization/29877
* tree-ssa-ter.c (is_replaceable_p): Deem assignments with
a register variable on the RHS to not be replaceable.
2007-01-08 Chen Liqin <liqin@sunnorth.com.cn>
* config/score/t-score-elf (MULTILIB_OPTIONS): Change.
* config/score/predicates.md (const_uimm5, sr0_operand, const_simm12,

View File

@ -1,3 +1,10 @@
2007-01-08 Mark Shinwell <shinwell@codesourcery.com>
PR tree-optimization/29877
* gcc.dg/pr16194.c: Skip test entirely if we don't know the
name of a hard register for the target concerned. Adjust dg-error
directives to cope with new behaviour of TER.
2007-01-07 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28986

View File

@ -2,6 +2,7 @@
/* { dg-options "-O" } */
/* { dg-bogus "internal compiler error" "ICE" { target *-*-* } 0 } */
#undef SKIP
#define ASMDECL __asm (REG);
#define CLOBBER_LIST : REG
#define INP_CLOBBER_LIST : CLOBBER_LIST
@ -18,17 +19,15 @@
# define REG "6"
#elif defined (__x86_64__)
# define REG "rax"
#elif defined (__m68k__)
# define REG "%d0"
#else
/* Make this test harmless for any target not recognized above. */
# undef ASMDECL
# define ASMDECL
# define REG "conflict"
# undef CLOBBER_LIST
# define CLOBBER_LIST
# undef INP_CLOBBER_LIST
# define INP_CLOBBER_LIST
/* Make this test harmless for any target not recognized above. */
# define SKIP 1
#endif
#ifndef SKIP
struct A
{
int a;
@ -47,7 +46,7 @@ struct C
void bug (void)
{
register char* dst ASMDECL;
__asm__ ("":"=g"(*dst): : REG); /* { dg-error "conflict" } */
__asm__ ("":"=g"(*dst): : REG);
}
/* The tree optimizers currently prevent us from finding an overlap -
@ -56,12 +55,22 @@ void bug (void)
void bug2 (void)
{
register char* dst ASMDECL;
__asm__ ("": :"g"(*dst) CLOBBER_LIST); /* { dg-error "conflict" } */
__asm__ ("": :"g"(*dst) CLOBBER_LIST);
}
void
foo (void)
{
register struct C *dst ASMDECL;
__asm__ ("" : "=g"(dst->c.b[1].a) INP_CLOBBER_LIST); /* { dg-error "conflict" } */
__asm__ ("" : "=g"(dst->c.b[1].a) INP_CLOBBER_LIST);
}
#else
int main ()
{
return 0;
}
#endif

View File

@ -393,6 +393,12 @@ is_replaceable_p (tree stmt)
&& FLOAT_TYPE_P (TREE_TYPE (GENERIC_TREE_OPERAND (stmt, 1))))
return false;
/* An assignment with a register variable on the RHS is not
replaceable. */
if (TREE_CODE (GENERIC_TREE_OPERAND (stmt, 1)) == VAR_DECL
&& DECL_HARD_REGISTER (GENERIC_TREE_OPERAND (stmt, 1)))
return false;
/* Calls to functions with side-effects cannot be replaced. */
if ((call_expr = get_call_expr_in (stmt)) != NULL_TREE)
{