https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563

--- Comment #27 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 10 Mar 2015, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563
> 
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |jakub at gcc dot gnu.org
> 
> --- Comment #25 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Or perhaps add split_block variant that uses the old bb for the second part
> rather than the first one, and use it in the inliner?

Seems like

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c   (revision 221317)
+++ gcc/tree-inline.c   (working copy)
@@ -4777,18 +4781,19 @@ static bool
 gimple_expand_calls_inline (basic_block bb, copy_body_data *id)
 {
   gimple_stmt_iterator gsi;
+  bool inlined = false;

-  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+  for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);)
     {
       gimple stmt = gsi_stmt (gsi);
+      gsi_prev (&gsi);

       if (is_gimple_call (stmt)
-         && !gimple_call_internal_p (stmt)
-         && expand_call_inline (bb, stmt, id))
-       return true;
+         && !gimple_call_internal_p (stmt))
+       inlined |= expand_call_inline (bb, stmt, id);
     }

-  return false;
+  return inlined;
 }


fixes the issue as well as gsi stays valid over inline expansion if
we advance it before that.

Reply via email to