diff options
author | David Daney <ddaney@caviumnetworks.com> | 2009-09-03 05:01:40 +0000 |
---|---|---|
committer | David Daney <daney@gcc.gnu.org> | 2009-09-03 05:01:40 +0000 |
commit | 896aa4eae3cd9f463597e8717ac8722ff7050965 (patch) | |
tree | bcd50e973902119516f03bdc0a265a1b5dc16135 /gcc | |
parent | 4537ec0c8652889bc6decbcf5647f889d2a14733 (diff) | |
download | gcc-896aa4eae3cd9f463597e8717ac8722ff7050965.zip gcc-896aa4eae3cd9f463597e8717ac8722ff7050965.tar.gz gcc-896aa4eae3cd9f463597e8717ac8722ff7050965.tar.bz2 |
cfgbuild.c (find_bb_boundaries): Split blocks containing a barrier.
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.
From-SVN: r151361
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cfgbuild.c | 7 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 19 | ||||
-rw-r--r-- | gcc/rtl.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c | 6 |
6 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b0abc83..df21296 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 012bd0b..6e941bf 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 9096a62..65022fc 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. */ @@ -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 277bcc7..06e5050 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 0000000..dd32ca8 --- /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 (); +} |