gcc/gcc44-vta-rh521991-2.patch

53 lines
1.3 KiB
Diff

2009-10-08 Jakub Jelinek <jakub@redhat.com>
* tree-ssa-operands.c (pop_stmt_changes): In DEBUG stmts, if
an SSA operand is DECL_P and referenced, mark it for renaming.
* gcc.dg/debug/vta-2.c: New test.
--- gcc/tree-ssa-operands.c.jj 2009-10-08 01:08:23.000000000 +0200
+++ gcc/tree-ssa-operands.c 2009-10-08 08:57:45.000000000 +0200
@@ -2715,12 +2715,16 @@ pop_stmt_changes (gimple *stmt_p)
if (gimple_debug_bind_p (stmt))
{
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF|SSA_OP_USE)
- if (DECL_P (op) && !referenced_var_p (op))
+ if (!DECL_P (op))
+ continue;
+ else if (!referenced_var_p (op))
{
gimple_debug_bind_reset_value (stmt);
update_stmt (stmt);
break;
}
+ else
+ mark_sym_for_renaming (op);
}
else
{
--- gcc/testsuite/gcc.dg/debug/vta-2.c.jj 2009-10-08 09:55:36.000000000 +0200
+++ gcc/testsuite/gcc.dg/debug/vta-2.c 2009-10-08 09:55:49.000000000 +0200
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+static int
+bar (void *a, unsigned int b, int n)
+{
+ int c = *(unsigned long *) a % b;
+ *(unsigned long *) a = (int) (*(unsigned long *) a) / b;
+ return c;
+}
+
+int
+foo (unsigned long x, int *y, int z)
+{
+ int level;
+ for (level = 0; level < *y; level++)
+ {
+ bar (&x, z, sizeof (x));
+ if (x)
+ return *y - 1;
+ }
+}