In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW region index. In this case, we should *not* add an EH edge during VPT.
Bootstrapped and passed regression test. OK for trunk? Thanks, Dehao gcc/ChangeLog: 2013-07-08 Dehao Chen (de...@google.com) * value-prof.c (gimple_ic): Fix the bug of adding EH edge. Index: gcc/value-prof.c =================================================================== --- gcc/value-prof.c (revision 200375) +++ gcc/value-prof.c (working copy) @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node * /* Build an EH edge for the direct call if necessary. */ lp_nr = lookup_stmt_eh_lp (icall_stmt); - if (lp_nr != 0 - && stmt_could_throw_p (dcall_stmt)) + if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt)) { edge e_eh, e; edge_iterator ei;