PR tree-optimization/29877
authorshinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2007 08:33:42 +0000 (08:33 +0000)
committershinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2007 08:33:42 +0000 (08:33 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120571 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr16194.c
gcc/tree-ssa-ter.c

index 8e36d91..371f105 100644 (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,
index a42328a..47dce00 100644 (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
index 313f0ea..eeb779e 100644 (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
 # 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
+
index ca67f91..c6b7ab3 100644 (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)
     {