re PR debug/63581 (undefined references in debug_info)
authorRong Xu <xur@gcc.gnu.org>
Fri, 14 Nov 2014 00:30:31 +0000 (00:30 +0000)
committerRong Xu <xur@gcc.gnu.org>
Fri, 14 Nov 2014 00:30:31 +0000 (00:30 +0000)
2014-11-13  Rong Xu  <xur@google.com>

gcc:
PR debug/63581
* cfgrtl.c (emit_barrier_after_bb): Append the barrier to the
  footer, instead of unconditionally overwritten

gcc/testsuite:
PR debug/63581
* g++.dg/tree-prof/pr63581.C: New test.

From-SVN: r217530

gcc/ChangeLog
gcc/cfgrtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-prof/pr63581.C [new file with mode: 0644]

index 98d5668..ff92bb2 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-13  Rong Xu  <xur@google.com>
+
+       PR debug/63581
+       * cfgrtl.c (emit_barrier_after_bb): Append the barrier to the
+       footer, instead of unconditionally overwritten.
+
 2014-11-14  Martin Jambor  <mjambor@suse.cz>
 
        * cgraph.h (clear_outer_type): Make public.  Fix comment.
        (lds_fpscr, sts_fpscr): New insns.
        (toggle_sz, toggle_pr): Use SImode for FPSCR_REG instead of PSImode.
 
+>>>>>>> .r217525
 2014-10-17  Eric Botcazou  <ebotcazou@adacore.com>
 
        * ipa-inline-transform.c (master_clone_with_noninline_clones_p): New.
index f6eb207..42d21d7 100644 (file)
@@ -1461,7 +1461,24 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
               || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-    BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+    {
+      rtx_insn *insn = unlink_insn_chain (barrier, barrier);
+
+      if (BB_FOOTER (bb))
+       {
+          rtx_insn *footer_tail = BB_FOOTER (bb);
+
+          while (NEXT_INSN (footer_tail))
+            footer_tail = NEXT_INSN (footer_tail);
+          if (!BARRIER_P (footer_tail))
+            {
+              SET_NEXT_INSN (footer_tail) = insn;
+              SET_PREV_INSN (insn) = footer_tail;
+            }
+       }
+      else
+        BB_FOOTER (bb) = insn;
+    }
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection
index bd2c51a..c61744b 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-13  Rong Xu  <xur@google.com>
+
+       PR debug/63581
+       * g++.dg/tree-prof/pr63581.C: New test.
+
 2014-11-13  Teresa Johnson  <tejohnson@google.com>
 
        PR tree-optimization/63841
        * gcc.dg/attr-isr.c: Move SH specific test to ...
        * gcc.target/sh/attr-isr.c: ... here.
 
+>>>>>>> .r217525
 2014-10-17  Marek Polacek  <polacek@redhat.com>
 
        PR c/63567
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr63581.C b/gcc/testsuite/g++.dg/tree-prof/pr63581.C
new file mode 100644 (file)
index 0000000..c8caf07
--- /dev/null
@@ -0,0 +1,91 @@
+// { dg-require-effective-target freorder }
+/* { dg-options "-O2 -g -fno-peel-loops" } */
+
+struct page {
+  int i;
+} global;
+
+__attribute__((noinline)) static struct page* find_page1 (int i)
+{
+  if ( i< 150)
+      return 0;
+  global.i = i;
+  return &global;
+}
+
+__attribute__((noinline)) static struct page* find_page2 (int i)
+{
+  global.i = i;
+  return &global;
+}
+
+volatile int ii;
+__attribute__((noinline)) static int zero (void)
+{
+  return ii;
+}
+
+static inline int uptodate (struct page* p)
+{
+  return (p->i < 709);
+}
+
+static struct page* bar(int i)
+{
+  struct page *page;
+
+repeat:
+  page = find_page1 (i);
+  if (!page) {
+    page = find_page2 (i);
+    if (!page)
+      return 0;
+    if (zero () ) {
+      zero ();
+      goto repeat;
+    }
+  }
+  return page;
+}
+
+__attribute__((noinline)) int foo (int n)
+{
+  struct page *page;
+
+retry:
+  page = bar (n);
+  if (page == 0)
+    return 0;
+  if (uptodate (page))
+    goto out;
+
+   zero ();
+   if (page->i < 0) {
+     zero ();
+     goto retry;
+   }
+out:
+   return 1;
+}
+
+__attribute__((noinline)) int hot (void)
+{
+  int i;
+  int sum = 0;
+
+  for (i = 0; i < 433038; i++)
+    sum+=i;
+
+  return sum;
+}
+
+int main(void)
+{
+  int i;
+
+  global.i = hot ();
+  for (i = 0; i < 858; i++)
+    foo (i);
+
+  return 0;
+}