From 1e211590c3288acd5ea6ff4edb94a1efd5ec25f7 Mon Sep 17 00:00:00 2001 From: David Daney Date: Sat, 25 Jul 2009 20:25:18 +0000 Subject: re PR rtl-optimization/40445 (g++ void f() { __builtin_unreachable(); }) 2009-07-25 David Daney PR rtl-optimization/40445 * emit-rtl.c (next_nonnote_insn_bb): New function. * rtl.h (next_nonnote_insn_bb): Declare new function. * cfgcleanup.c (try_optimize_cfg): Don't remove an empty block with no successors that is the successor of the ENTRY_BLOCK. Continue from the top after removing an empty fallthrough block. * cfgrtl.c (get_last_bb_insn): Call next_nonnote_insn_bb instead of next_nonnote_insn. 2009-07-25 David Daney PR rtl-optimization/40445 * g++.dg/other/builtin-unreachable-1.C: New testcase. From-SVN: r150090 --- gcc/emit-rtl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc/emit-rtl.c') diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 5b42f4a..21d8434 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2998,6 +2998,25 @@ next_nonnote_insn (rtx insn) return insn; } +/* Return the next insn after INSN that is not a NOTE, but stop the + search before we enter another basic block. This routine does not + look inside SEQUENCEs. */ + +rtx +next_nonnote_insn_bb (rtx insn) +{ + while (insn) + { + insn = NEXT_INSN (insn); + if (insn == 0 || !NOTE_P (insn)) + break; + if (NOTE_INSN_BASIC_BLOCK_P (insn)) + return NULL_RTX; + } + + return insn; +} + /* Return the previous insn before INSN that is not a NOTE. This routine does not look inside SEQUENCEs. */ -- cgit v1.1