summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-29 19:36:47 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-29 19:36:47 +0000
commit246d67df8bf4a050ccd801f2e55599a032c7599a (patch)
treee8add9a26d8368777c8713859ad9a343912fc457 /gcc/tree-ssa-threadedge.c
parente43ff6d494044f752229b1228aad94621f90dbff (diff)
downloadgcc-246d67df8bf4a050ccd801f2e55599a032c7599a.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192961 138bc75d-0d04-0410-961f-82ee72b054a4
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 ddaa7d12f19..f43a564d786 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;