aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2012-10-29 19:36:47 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2012-10-29 19:36:47 +0000
commit61dc0ea735b12329bcb88eeb1e11255f86b295f7 (patch)
treee8add9a26d8368777c8713859ad9a343912fc457 /gcc/tree-ssa-threadedge.c
parent6119d95c67f627e95131041c5d33756d42c892a3 (diff)
downloadgcc-61dc0ea735b12329bcb88eeb1e11255f86b295f7.zip
gcc-61dc0ea735b12329bcb88eeb1e11255f86b295f7.tar.gz
gcc-61dc0ea735b12329bcb88eeb1e11255f86b295f7.tar.bz2
re PR debug/54693 (VTA guality issues with loops)
gcc/ChangeLog: PR debug/54693 * tree-ssa-threadedge.c (thread_around_empty_block): Copy debug temps from predecessor before threading. gcc/testsuite/ChangeLog: PR debug/54693 * gcc.dg/guality/pr54693.c: New. From-SVN: r192961
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r--gcc/tree-ssa-threadedge.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index ddaa7d1..f43a564 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -637,6 +637,24 @@ thread_around_empty_block (edge taken_edge,
if (!single_pred_p (bb))
return NULL;
+ /* Before threading, copy DEBUG stmts from the predecessor, so that
+ we don't lose the bindings as we redirect the edges. */
+ if (MAY_HAVE_DEBUG_STMTS)
+ {
+ gsi = gsi_after_labels (bb);
+ for (gimple_stmt_iterator si = gsi_last_bb (taken_edge->src);
+ !gsi_end_p (si); gsi_prev (&si))
+ {
+ stmt = gsi_stmt (si);
+ if (!is_gimple_debug (stmt))
+ continue;
+
+ stmt = gimple_copy (stmt);
+ /* ??? Should we drop the location of the copy? */
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+ }
+ }
+
/* This block must have more than one successor. */
if (single_succ_p (bb))
return NULL;