diff options
author | Mark Shinwell <shinwell@codesourcery.com> | 2007-01-08 08:33:42 +0000 |
---|---|---|
committer | Mark Shinwell <shinwell@gcc.gnu.org> | 2007-01-08 08:33:42 +0000 |
commit | 46e3b90f7e326c672c4ecddf5287f603a89d03ef (patch) | |
tree | 86d028c760c73cbf43467080ea39ca9e8bbad562 /gcc | |
parent | 99fc25020d47424e0c0b0da370e2e18540b96b73 (diff) | |
download | gcc-46e3b90f7e326c672c4ecddf5287f603a89d03ef.zip gcc-46e3b90f7e326c672c4ecddf5287f603a89d03ef.tar.gz gcc-46e3b90f7e326c672c4ecddf5287f603a89d03ef.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr16194.c | 31 | ||||
-rw-r--r-- | gcc/tree-ssa-ter.c | 6 |
4 files changed, 39 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e36d91..371f105 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a42328a..47dce00 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gcc.dg/pr16194.c b/gcc/testsuite/gcc.dg/pr16194.c index 313f0ea..eeb779e 100644 --- a/gcc/testsuite/gcc.dg/pr16194.c +++ b/gcc/testsuite/gcc.dg/pr16194.c @@ -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 + diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index ca67f91..c6b7ab3 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -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) { |