This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[debuglocus] Preserve locus when merging phis in phi-optimizations.
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 Mar 2009 15:59:12 -0400
- Subject: [debuglocus] Preserve locus when merging phis in phi-optimizations.
Just another place to preserve a locus I stumbled across
Bootstrapped on x86_64-unknown-linux-gnu with no new regressions.
Andrew
2009-03-24 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-phiopt.c (conditional_replacement): Preserve locus when
merging phi nodes.
Index: tree-ssa-phiopt.c
===================================================================
*** tree-ssa-phiopt.c (revision 145035)
--- tree-ssa-phiopt.c (working copy)
*************** conditional_replacement (basic_block con
*** 513,518 ****
--- 513,520 ----
if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var)))
{
+ source_location locus_0, locus_1;
+
new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
add_referenced_var (new_var2);
new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
*************** conditional_replacement (basic_block con
*** 521,526 ****
--- 523,535 ----
gimple_assign_set_lhs (new_stmt, new_var2);
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
new_var = new_var2;
+
+ /* Set the locus to the first argument, unless is doesn;t have one. */
+ locus_0 = gimple_phi_arg_location (phi, 0);
+ locus_1 = gimple_phi_arg_location (phi, 1);
+ if (locus_0 == UNKNOWN_LOCATION)
+ locus_0 = locus_1;
+ gimple_set_location (new_stmt, locus_0);
}
replace_phi_edge_with_variable (cond_bb, e1, phi, new_var);