2015-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
authorthopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Aug 2015 02:11:58 +0000 (02:11 +0000)
committerthopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Aug 2015 02:11:58 +0000 (02:11 +0000)
    gcc/
    PR tree-optimization/67043
    * loop-invariant.c (move_invariant_reg): Recompute luids in loop
    preheader after hoisting invariant in it.
    (find_defs): Force recomputation of all luids.

    gcc/testsuite/
    PR tree-optimization/67043
    * gcc.dg/pr67043.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226540 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/loop-invariant.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr67043.c [new file with mode: 0644]

index eb4a604..acb75e8 100644 (file)
@@ -1,3 +1,10 @@
+2015-08-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/67043
+       * loop-invariant.c (move_invariant_reg): Recompute luids in loop
+       preheader after hoisting invariant in it.
+       (find_defs): Force recomputation of all luids.
+
 2015-08-03  Peter Bergner  <bergner@vnet.ibm.com>
 
        * config/rs6000/htm.md (tabort.): Restrict the source operand to
index 1fdb84d..52c8ae8 100644 (file)
@@ -676,6 +676,8 @@ find_defs (struct loop *loop)
   df_remove_problem (df_chain);
   df_process_deferred_rescans ();
   df_chain_add_problem (DF_UD_CHAIN);
+  df_live_add_problem ();
+  df_live_set_all_dirty ();
   df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
   df_analyze_loop (loop);
   check_invariant_table_size ();
@@ -1629,6 +1631,7 @@ move_invariant_reg (struct loop *loop, unsigned invno)
        fprintf (dump_file, "Invariant %d moved without introducing a new "
                            "temporary register\n", invno);
       reorder_insns (inv->insn, inv->insn, BB_END (preheader));
+      df_recompute_luids (preheader);
 
       /* If there is a REG_EQUAL note on the insn we just moved, and the
         insn is in a basic block that is not always executed or the note
index f34d9fd..ae404d3 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/67043
+       * gcc.dg/pr67043.c: New test.
+
 2015-08-03  Peter Bergner  <bergner@vnet.ibm.com>
 
        * gcc.target/powerpc/htm-tabort-no-r0.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr67043.c b/gcc/testsuite/gcc.dg/pr67043.c
new file mode 100644 (file)
index 0000000..36aa686
--- /dev/null
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug -w" } */
+
+extern void rt_mutex_owner (void);
+extern void rt_mutex_deadlock_account_lock (int);
+extern void signal_pending (void);
+__typeof__ (int *) a;
+int b;
+
+int
+try_to_take_rt_mutex (int p1) {
+  rt_mutex_owner ();
+  if (b)
+    return 0;
+  rt_mutex_deadlock_account_lock (p1);
+  return 1;
+}
+
+void
+__rt_mutex_slowlock (int p1) {
+  int c;
+  for (;;) {
+    c = ({
+      asm ("" : "=r"(a));
+      a;
+    });
+    if (try_to_take_rt_mutex (c))
+      break;
+    if (__builtin_expect (p1 == 0, 0))
+      signal_pending ();
+  }
+}