This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR 32321 - missing rescanning causing verification failure under gcse-sm


Hi,

In PR 32321 (with -fgcse-sm),
REG_NOTE changes were not scanned
because it was done after the insn was emitted.
Instead of rescanning, here I move the insn emission after REG_NOTE change,
since emission routines do scanning for newly added insns anyway.
Bootstrapped and regtested on x86-64.
Ok ?

ChangeLog:

2007-06-14 Seongbae Park <seongbae.park@gmail.com>

       PR rtl-optimization/32321
       * gcse.c (replace_store_insn): Update the note before
       calling emit_insn_after.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";

Index: gcse.c
===================================================================
--- gcse.c      (revision 125736)
+++ gcse.c      (working copy)
@@ -6341,17 +6341,6 @@ replace_store_insn (rtx reg, rtx del, ba

  mem = smexpr->pattern;
  insn = gen_move_insn (reg, SET_SRC (single_set (del)));
-  insn = emit_insn_after (insn, del);
-
-  if (dump_file)
-    {
-      fprintf (dump_file,
-              "STORE_MOTION  delete insn in BB %d:\n      ", bb->index);
-      print_inline_rtx (dump_file, del, 6);
-      fprintf (dump_file, "\nSTORE MOTION  replaced with insn:\n      ");
-      print_inline_rtx (dump_file, insn, 6);
-      fprintf (dump_file, "\n");
-    }

  for (ptr = ANTIC_STORE_LIST (smexpr); ptr; ptr = XEXP (ptr, 1))
    if (XEXP (ptr, 0) == del)
@@ -6379,6 +6368,20 @@ replace_store_insn (rtx reg, rtx del, ba
      XEXP (note, 0) = insn;
    }

+  /* Emit the insn AFTER all the notes are transferred.
+     This is cheaper since we avoid df rescanning for the note change.  */
+  insn = emit_insn_after (insn, del);
+
+  if (dump_file)
+    {
+      fprintf (dump_file,
+              "STORE_MOTION  delete insn in BB %d:\n      ", bb->index);
+      print_inline_rtx (dump_file, del, 6);
+      fprintf (dump_file, "\nSTORE MOTION  replaced with insn:\n      ");
+      print_inline_rtx (dump_file, insn, 6);
+      fprintf (dump_file, "\n");
+    }
+
  delete_insn (del);

/* Now we must handle REG_EQUAL notes whose contents is equal to the mem;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]