This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[LTO][PATCH] Fix for LTO ICE for mixed optimization compilations
- From: simonb at google dot com (Simon Baldwin)
- To: gcc-patches at gcc dot gnu dot org
- Cc: jh at suse dot cz, amacleod at redhat dot com
- Date: Sat, 17 Jan 2009 11:44:25 +0000 (GMT)
- Subject: [LTO][PATCH] Fix for LTO ICE for mixed optimization compilations
This patch fixes an LTO ICE that occurs where pickled IL generated with -O1
is processed later on by lto1 without optimization (-O0).
The patch works by skipping SSA names for debugging if they do not map to a
partition. This is the same check as made elsewhere in this module.
gcc/ChangeLog.lto
2009-01-16 Simon Baldwin <simonb@google.com>
* tree-ssa-coalesce.c (coalesce_ssa_name): Skip an SSA name if
it does not map to a partition.
gcc/testsuite/ChangeLog.lto
2009-01-16 Simon Baldwin <simonb@google.com>
* gcc.dg/lto/20090116_0.c: New.
Index: gcc/testsuite/gcc.dg/lto/20090116_0.c
===================================================================
--- gcc/testsuite/gcc.dg/lto/20090116_0.c (revision 0)
+++ gcc/testsuite/gcc.dg/lto/20090116_0.c (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do link } */
+/* { dg-options "{-O1 -fwhopr -fPIC}" } */
+/* { dg-extra-ld-options {-shared -O0} } */
+
+int foo(void) {
+ int ret, i;
+ for (i = 0; i < 1; i++)
+ ret = 0;
+ for (i = 0; i < 1; i++)
+ ret = 1;
+ return ret;
+}
Index: gcc/tree-ssa-coalesce.c
===================================================================
--- gcc/tree-ssa-coalesce.c (revision 143457)
+++ gcc/tree-ssa-coalesce.c (working copy)
@@ -1355,7 +1355,8 @@ coalesce_ssa_name (void)
{
tree a = ssa_name (i);
- if (a && SSA_NAME_VAR (a) && !DECL_ARTIFICIAL (SSA_NAME_VAR (a)))
+ if (a && SSA_NAME_VAR (a) && !DECL_ARTIFICIAL (SSA_NAME_VAR (a))
+ && map->partition_to_var[i] != NULL)
{
tree *slot = (tree *) htab_find_slot (ssa_name_hash, a, INSERT);