aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2014-11-14 00:30:31 +0000
committerRong Xu <xur@google.com>2014-11-14 00:30:31 +0000
commit36793665d397b2475eec1848d0855529d1bce566 (patch)
treea2d90d71efdd31c74e3e6708927cf8f6f80dd80b
parente472fbdf4e4788738a612de88135108abcf30b92 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@217530 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cfgrtl.c19
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/pr63581.C91
4 files changed, 122 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 98d5668abef..ff92bb235dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
@@ -6399,6 +6405,7 @@
(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.
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index f6eb2072d11..42d21d72201 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bd2c51a074e..c61744b4b44 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
@@ -3153,6 +3158,7 @@
* 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
index 00000000000..c8caf076584
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-prof/pr63581.C
@@ -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;
+}