[Bug inline-asm/79552] [6 Regression] Wrong code generation due to -fschedule-insns, with __restrict__ and inline asm

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 16 15:31:00 GMT 2017


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah...

          FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
            {
              /* ???  Calls and asms.  */
              if (!gimple_assign_single_p (use_stmt))
                continue;

and at PTA time we see

  <bb 2> [100.00%]:
  c.0_1 = (long unsigned int) c_3(D);
  __asm__("rep stosb" : "=D" a_7, "=c" n_8, "=m" MEM[(struct ._0 *)a_5(D)] :
"a" 0, "0" a_5(D), "1" c.0_1);
  _2 = *a_5(D);
  __asm__ __volatile__("xor %0, %0" :  : "q" _2);
  return;

that's first a missed optimization.  The bug is in visit_loadstore which fails
to verify for default defs whether the pointer aliases a restrict one.

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 245501)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -7296,8 +7312,7 @@ visit_loadstore (gimple *, tree base, tr
       || TREE_CODE (base) == TARGET_MEM_REF)
     {
       tree ptr = TREE_OPERAND (base, 0);
-      if (TREE_CODE (ptr) == SSA_NAME
-         && ! SSA_NAME_IS_DEFAULT_DEF (ptr))
+      if (TREE_CODE (ptr) == SSA_NAME)
        {
          /* We need to make sure 'ptr' doesn't include any of
             the restrict tags we added bases for in its points-to set.  */


More information about the Gcc-bugs mailing list