Comment 20 for bug 885280

Revision history for this message
In , Rguenth (rguenth) wrote :

We run into

              /* With return slot optimization we can end up with
                 non-gimple (foo *)&this->m, fix that here. */
              if (TREE_CODE (new_arg) != SSA_NAME
                  && TREE_CODE (new_arg) != FUNCTION_DECL
                  && !is_gimple_val (new_arg))
                {
                  gimple_seq stmts = NULL;
                  new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
                  gsi_insert_seq_on_edge_immediate (new_edge, stmts);

but inserting on an edge that needs splitting, which wrecks new_edge.

Index: tree-inline.c
===================================================================
--- tree-inline.c (revision 164388)
+++ tree-inline.c (working copy)
@@ -2021,8 +2021,11 @@ copy_phis_for_bb (basic_block bb, copy_b
     && !is_gimple_val (new_arg))
   {
     gimple_seq stmts = NULL;
+ basic_block tem;
     new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
- gsi_insert_seq_on_edge_immediate (new_edge, stmts);
+ tem = gsi_insert_seq_on_edge_immediate (new_edge, stmts);
+ if (tem)
+ new_edge = find_edge (tem, new_bb);
   }
        add_phi_arg (new_phi, new_arg, new_edge,
       gimple_phi_arg_location_from_edge (phi, old_edge));

fixes that.