From: Richard Biener Date: Tue, 29 Nov 2016 14:01:32 +0000 (+0000) Subject: tree-cfg.c (lower_phi_internal_fn): Do not look for further PHIs after a regular... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00738904f305a6237c2bae72b5fd7789995c4399;p=gcc.git tree-cfg.c (lower_phi_internal_fn): Do not look for further PHIs after a regular stmt. 2016-11-29 Richard Biener * tree-cfg.c (lower_phi_internal_fn): Do not look for further PHIs after a regular stmt. (stmt_starts_bb_p): PHIs not preceeded by a PHI or a label start a new BB. From-SVN: r242959 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index feb30a8d1bd..2771bfd0fb7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-11-29 Richard Biener + + * tree-cfg.c (lower_phi_internal_fn): Do not look for further + PHIs after a regular stmt. + (stmt_starts_bb_p): PHIs not preceeded by a PHI or a label + start a new BB. + 2016-11-29 Martin Liska PR gcov-profile/78582 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e99e1022b6c..6cb5b6f5b5f 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -361,14 +361,11 @@ lower_phi_internal_fn () /* After edge creation, handle __PHI function from GIMPLE FE. */ FOR_EACH_BB_FN (bb, cfun) { - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) + for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi);) { stmt = gsi_stmt (gsi); if (! gimple_call_internal_p (stmt, IFN_PHI)) - { - gsi_next (&gsi); - continue; - } + break; lhs = gimple_call_lhs (stmt); phi_node = create_phi_node (lhs, bb); @@ -2604,11 +2601,21 @@ stmt_starts_bb_p (gimple *stmt, gimple *prev_stmt) else return true; } - else if (gimple_code (stmt) == GIMPLE_CALL - && gimple_call_flags (stmt) & ECF_RETURNS_TWICE) - /* setjmp acts similar to a nonlocal GOTO target and thus should - start a new block. */ - return true; + else if (gimple_code (stmt) == GIMPLE_CALL) + { + if (gimple_call_flags (stmt) & ECF_RETURNS_TWICE) + /* setjmp acts similar to a nonlocal GOTO target and thus should + start a new block. */ + return true; + if (gimple_call_internal_p (stmt, IFN_PHI) + && prev_stmt + && gimple_code (prev_stmt) != GIMPLE_LABEL + && (gimple_code (prev_stmt) != GIMPLE_CALL + || ! gimple_call_internal_p (prev_stmt, IFN_PHI))) + /* PHI nodes start a new block unless preceeded by a label + or another PHI. */ + return true; + } return false; }