This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] don't remap blocks on inlining just because of debug stmts
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 06 Mar 2009 05:49:16 -0300
- Subject: [vta] don't remap blocks on inlining just because of debug stmts
After Honza's recent patches to drop empty blocks, debug stmts may refer
to blocks that are no longer in a function's lexical block tree. When
the function was inlined, the debug stmts would cause the block to be
remapped, so that any variables in them would also be remapped, causing
declaration uids to go out of sync with a non-VTA compilation.
This patch fixes this -fcompare-debug regression. I'm installing it in
the branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* tree-inline.c (remap_gimple_stmt): Don't remap blocks for
debug stmts.
(copy_debug_stmt): Use already-remapped blocks for them.
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c.orig 2009-03-01 04:35:11.000000000 -0300
+++ gcc/tree-inline.c 2009-03-04 05:09:20.000000000 -0300
@@ -1244,6 +1244,7 @@ remap_gimple_stmt (gimple stmt, copy_bod
VAR_DEBUG_VALUE_VALUE (stmt),
stmt);
VARRAY_PUSH_GENERIC_PTR (id->debug_stmts, copy);
+ return copy;
}
else
/* Create a new deep copy of the statement. */
@@ -1258,15 +1259,8 @@ remap_gimple_stmt (gimple stmt, copy_bod
{
tree *n;
n = (tree *) pointer_map_contains (id->decl_map, gimple_block (copy));
- if (n)
- new_block = *n;
- else
- {
- tree nb = gimple_block (copy);
- gcc_assert (IS_DEBUG_BIND (copy));
- remap_block (&nb, id);
- new_block = nb;
- }
+ gcc_assert (n);
+ new_block = *n;
}
gimple_set_block (copy, new_block);
@@ -1948,6 +1942,16 @@ copy_debug_stmt (gimple stmt, copy_body_
tree t, *n;
struct walk_stmt_info wi;
+ t = id->block;
+ if (gimple_block (stmt))
+ {
+ tree *n;
+ n = (tree *) pointer_map_contains (id->decl_map, gimple_block (stmt));
+ if (n)
+ t = *n;
+ }
+ gimple_set_block (stmt, t);
+
/* Remap all the operands in COPY. */
memset (&wi, 0, sizeof (wi));
wi.info = id;
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer