The following patch addresses the issue that asms which clobber
hard registers are no optimization barriers for local hardreg
vars on GIMPLE.

Bootstrapped / tested on x86_64-unknown-linux-gnu.

OK?

Thanks,
Richard.

2019-03-29  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/87984
        * gimple.c (gimple_asm_clobbers_memory_p): Treat asms
        which clobber registers as modifying memory.

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