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
This commit is contained in:
Alexandre Oliva 2012-10-29 19:36:47 +00:00 committed by Alexandre Oliva
parent 6119d95c67
commit 61dc0ea735
4 changed files with 57 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2012-10-29 Alexandre Oliva <aoliva@redhat.com>
PR debug/54693
* tree-ssa-threadedge.c (thread_around_empty_block): Copy
debug temps from predecessor before threading.
2012-10-29 Alexandre Oliva <aoliva@redhat.com>
PR debug/54551

View file

@ -1,3 +1,8 @@
2012-10-29 Alexandre Oliva <aoliva@redhat.com>
PR debug/54693
* gcc.dg/guality/pr54693.c: New.
2012-10-29 Marc Glisse <marc.glisse@inria.fr>
PR middle-end/55027

View file

@ -0,0 +1,28 @@
/* PR debug/54693 */
/* { dg-do run } */
/* { dg-options "-g" } */
__attribute__((noinline, noclone)) void
foo (char *str, char c)
{
asm volatile ("" : : "r" (str), "r" (c) : "memory");
*str = c;
}
int
main ()
{
int i;
char c;
char arr[11];
for (i = 0; i < 10; i++)
{
c = 0x30 + i;
foo (&arr[i], c); /* { dg-final { gdb-test 22 "i" "c - 48" } } */
}
__builtin_printf ("arr = %s\n", arr);
return 0;
}

View file

@ -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;