summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authordaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-03 05:01:40 +0000
committerdaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-03 05:01:40 +0000
commitbcc66782af23a6a40efd513ec5b7b1d6f6f6e44a (patch)
treebcd50e973902119516f03bdc0a265a1b5dc16135 /gcc
parent34e5cced0545b23499caed535a6566a4026b9558 (diff)
downloadppe42-gcc-bcc66782af23a6a40efd513ec5b7b1d6f6f6e44a.tar.gz
ppe42-gcc-bcc66782af23a6a40efd513ec5b7b1d6f6f6e44a.zip
2009-09-02 David Daney <ddaney@caviumnetworks.com>
* cfgbuild.c (find_bb_boundaries): Split blocks containing a barrier. * emit-rtl.c (prev_nonnote_insn_bb): New function. * rtl.h (prev_nonnote_insn_bb): Declare it. 2009-09-02 David Daney <ddaney@caviumnetworks.com> * gcc.c-torture/compile/builtin_unreachable-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151361 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cfgbuild.c7
-rw-r--r--gcc/emit-rtl.c19
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c6
6 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0abc837876..df2129678bc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-09-02 David Daney <ddaney@caviumnetworks.com>
+
+ * cfgbuild.c (find_bb_boundaries): Split blocks containing a
+ barrier.
+ * emit-rtl.c (prev_nonnote_insn_bb): New function.
+ * rtl.h (prev_nonnote_insn_bb): Declare it.
+
2009-09-03 Diego Novillo <dnovillo@google.com>
* cgraph.c (cgraph_node_for_decl): New.
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 012bd0b6be7..6e941bf55e9 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -469,6 +469,13 @@ find_bb_boundaries (basic_block bb)
make_edge (ENTRY_BLOCK_PTR, bb, 0);
}
+ /* __builtin_unreachable () may cause a barrier to be emitted in
+ the middle of a BB. We need to split it in the same manner
+ as if the barrier were preceded by a control_flow_insn_p
+ insn. */
+ if (code == BARRIER && !flow_transfer_insn)
+ flow_transfer_insn = prev_nonnote_insn_bb (insn);
+
/* In case we've previously seen an insn that effects a control
flow transfer, split the block. */
if (flow_transfer_insn && inside_basic_block_p (insn))
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 9096a62dcbf..65022fc65e3 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3082,6 +3082,25 @@ prev_nonnote_insn (rtx insn)
return insn;
}
+/* Return the previous insn before INSN that is not a NOTE, but stop
+ the search before we enter another basic block. This routine does
+ not look inside SEQUENCEs. */
+
+rtx
+prev_nonnote_insn_bb (rtx insn)
+{
+ while (insn)
+ {
+ insn = PREV_INSN (insn);
+ if (insn == 0 || !NOTE_P (insn))
+ break;
+ if (NOTE_INSN_BASIC_BLOCK_P (insn))
+ return NULL_RTX;
+ }
+
+ return insn;
+}
+
/* Return the next insn after INSN that is not a DEBUG_INSN. This
routine does not look inside SEQUENCEs. */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 172afd0244d..c5839df4ecb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1675,6 +1675,7 @@ extern rtx last_call_insn (void);
extern rtx previous_insn (rtx);
extern rtx next_insn (rtx);
extern rtx prev_nonnote_insn (rtx);
+extern rtx prev_nonnote_insn_bb (rtx);
extern rtx next_nonnote_insn (rtx);
extern rtx next_nonnote_insn_bb (rtx);
extern rtx prev_nondebug_insn (rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 277bcc7a4de..06e50502bc4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-02 David Daney <ddaney@caviumnetworks.com>
+
+ * gcc.c-torture/compile/builtin_unreachable-1.c: New testcase.
+
2009-09-03 Diego Novillo <dnovillo@google.com>
* gcc.dg/gomp/combined-1.c: Adjust expected pattern.
diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c
new file mode 100644
index 00000000000..dd32ca8066d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c
@@ -0,0 +1,6 @@
+void bar (const char *);
+void foo (void)
+{
+ bar ("foo");
+ __builtin_unreachable ();
+}
OpenPOWER on IntegriCloud