re PR rtl-optimization/56117 (ICE: in cselib_subst_to_values, at cselib.c:1853 with...
authorJakub Jelinek <jakub@redhat.com>
Mon, 28 Jan 2013 16:50:22 +0000 (17:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 28 Jan 2013 16:50:22 +0000 (17:50 +0100)
PR rtl-optimization/56117
* sched-deps.c (sched_analyze_2) <case PREFETCH>: For use_cselib
call cselib_lookup_from_insn on the MEM before calling
add_insn_mem_dependence.

* gcc.dg/pr56117.c: New test.

From-SVN: r195513

gcc/ChangeLog
gcc/sched-deps.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56117.c [new file with mode: 0644]

index 3bc0bd1..cab97ef 100644 (file)
@@ -1,3 +1,10 @@
+2013-01-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/56117
+       * sched-deps.c (sched_analyze_2) <case PREFETCH>: For use_cselib
+       call cselib_lookup_from_insn on the MEM before calling
+       add_insn_mem_dependence.
+
 2013-01-28  Richard Biener  <rguenther@suse.de>
 
        * tree-inline.c (remap_gimple_stmt): Do not assing a BLOCK
index 2b40286..7de974b 100644 (file)
@@ -2720,8 +2720,12 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn)
         prefetch has only the start address but it is better to have
         something than nothing.  */
       if (!deps->readonly)
-       add_insn_mem_dependence (deps, true, insn,
-                                gen_rtx_MEM (Pmode, XEXP (PATTERN (insn), 0)));
+       {
+         rtx x = gen_rtx_MEM (Pmode, XEXP (PATTERN (insn), 0));
+         if (sched_deps_info->use_cselib)
+           cselib_lookup_from_insn (x, Pmode, true, VOIDmode, insn);
+         add_insn_mem_dependence (deps, true, insn, x);
+       }
       break;
 
     case UNSPEC_VOLATILE:
index fecca1e..ebc18d9 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/56117
+       * gcc.dg/pr56117.c: New test.
+
 2013-01-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/56034
diff --git a/gcc/testsuite/gcc.dg/pr56117.c b/gcc/testsuite/gcc.dg/pr56117.c
new file mode 100644 (file)
index 0000000..2422048
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR rtl-optimization/56117 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fsched2-use-superblocks" } */
+
+void
+foo (void *p)
+{
+  __builtin_prefetch (p);
+}