https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984

--- Comment #28 from Richard Biener <rguenth at gcc dot gnu.org> ---
I am considering the following as a fix for the GIMPLE issue, does that
look acceptable?  I think a binary flag as suggested by Jakub results
in somewhat unpredictable behavior with regard to inlining I'd not
appreciate given inlining a function with hard-reg vars would suddenly
make asms in the caller subject to virtual operands... (not sure if we'd
not even ICE on that situation at the moment).  Similar situation occurs
if inlining an asm with hardreg clobbers from a function w/o local reg
vars into a function with local reg vars -- that function could even
be pure/const but would have to be treated not so.

So - mine for the GIMPLE part.

Any comments?

Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c        (revision 270012)
+++ gcc/gimple.c        (working copy)
@@ -2727,11 +2738,16 @@ gimple_asm_clobbers_memory_p (const gasm
 {
   unsigned i;

+  /* While strictly speaking only a "memory" clobber denotes clobbering
+     memory in GIMPLE we also treat local hard-register variables as
+     memory so simply treat all clobbers as memory.  The only exception
+     is the special clobber "cc".  */
   for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
     {
       tree op = gimple_asm_clobber_op (stmt, i);
-      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "memory") == 0)
-       return true;
+      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "cc") == 0)
+       continue;
+      return true;
     }

   /* Non-empty basic ASM implicitly clobbers memory.  */

Reply via email to