Fixed bug involving labels in GIMPLE_COND statements.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Tue, 17 Aug 2010 00:03:17 +0000 (20:03 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Tue, 17 Aug 2010 00:03:17 +0000 (20:03 -0400)
Turns out that once we're at the GIMPLE level, GIMPLE_CONDs should no
longer have labels.  The optimization routine that gets rid of
"forwarder" basic blocks is aware of this, so it does not update the
labes in the GIMPLE_COND when it redirects an edge.

The routine that cleans up unnecessary labels, however, sees these
labels, which may have been destroyed by the forwarder optimization,
and can crash as a result.

src/aop-duplicate.c

index 69f191335d33703ac8dcae4716a81b832e6291f8..3cc03e56ed6b84e0eca6868d03c7e517533c3cc0 100644 (file)
@@ -260,8 +260,6 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
       basic_block old_first_bb;
       basic_block new_first_bb;
 
-      tree old_label;
-      tree new_label;
       tree tmpvar;
 
       gimple cond;
@@ -273,11 +271,6 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
       new_first_bb = new_bb_for_old (bb_pairs, old_first_bb);
       aop_assert (new_first_bb != NULL);
 
-      old_label = gimple_block_label (old_first_bb);
-      new_label = gimple_block_label (new_first_bb);
-
-      /* TODO: Can this line be removed? */
-      DECL_SOURCE_LOCATION(new_label) = DECL_SOURCE_LOCATION(old_label);
       distributor_bb = split_edge(e);
 
       tmpvar = create_tmp_var(integer_type_node, tmpvar_name);
@@ -320,7 +313,7 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
       /* insert: if (tmpvar) goto <new_label> else goto <old_label> */
       cond = gimple_build_cond (NE_EXPR, tmpvar, 
                                build_int_cst (integer_type_node, 0),
-                               new_label, old_label);
+                               NULL_TREE, NULL_TREE);
       gsi_insert_before (&gsi, cond, GSI_SAME_STMT);
 
       remove_edge(single_succ_edge(distributor_bb));