aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-06-22 18:02:06 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-06-22 18:02:06 +0000
commit9c7c9f10c3bac5a7b3c5a46f52449cd095a767da (patch)
tree09cf8e6a4c12901e2c4ac308c41636ffb5c92b2f /gcc
parent7b902b811ba4b83f0bbd3c684d1bf01b4660c650 (diff)
downloadgcc-9c7c9f10c3bac5a7b3c5a46f52449cd095a767da.zip
gcc-9c7c9f10c3bac5a7b3c5a46f52449cd095a767da.tar.gz
gcc-9c7c9f10c3bac5a7b3c5a46f52449cd095a767da.tar.bz2
re PR tree-optimization/49493 (ICE: in insert_vi_for_tree, at tree-ssa-structalias.c:2637 with -O -fipa-pta)
2011-06-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/49493 * tree-ssa-structalias.c (get_constraint_for_ssa_var): Refer to the alias target of variables. (associate_varinfo_to_alias_1): Remove. (ipa_pta_execute): Do not associate aliases with anything. * cgraph.h (varpool_alias_aliased_node): Fix cut&paste errors. (cgraph_function_node): Likewise. (cgraph_function_or_thunk_node): Likewise. (varpool_variable_node): Likewise. * gcc.dg/ipa/ipa-pta-17.c: New testcase. From-SVN: r175300
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cgraph.h8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c6
-rw-r--r--gcc/tree-ssa-structalias.c26
5 files changed, 40 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea20421..bfb27d6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2011-06-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/49493
+ * tree-ssa-structalias.c (get_constraint_for_ssa_var):
+ Refer to the alias target of variables.
+ (associate_varinfo_to_alias_1): Remove.
+ (ipa_pta_execute): Do not associate aliases with anything.
+ * cgraph.h (varpool_alias_aliased_node): Fix cut&paste errors.
+ (cgraph_function_node): Likewise.
+ (cgraph_function_or_thunk_node): Likewise.
+ (varpool_variable_node): Likewise.
+
2011-06-22 Nathan Sidwell <nathan@codesourcery.com>
* config/arm/arm.h (OPTION_DEFAULT_SPECS): Fix -mtls-dialect
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index dd08feb..f912af2 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -981,7 +981,7 @@ varpool_alias_aliased_node (struct varpool_node *n)
ipa_ref_list_reference_iterate (&n->ref_list, 0, ref);
gcc_checking_assert (ref->use == IPA_REF_ALIAS);
- if (ref->refered_type == IPA_REF_CGRAPH)
+ if (ref->refered_type == IPA_REF_VARPOOL)
return ipa_ref_varpool_node (ref);
return NULL;
}
@@ -1011,7 +1011,7 @@ cgraph_function_node (struct cgraph_node *node, enum availability *availability)
*availability = a;
}
}
- if (*availability)
+ if (availability)
*availability = AVAIL_NOT_AVAILABLE;
return NULL;
}
@@ -1039,7 +1039,7 @@ cgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *avai
*availability = a;
}
}
- if (*availability)
+ if (availability)
*availability = AVAIL_NOT_AVAILABLE;
return NULL;
}
@@ -1067,7 +1067,7 @@ varpool_variable_node (struct varpool_node *node, enum availability *availabilit
*availability = a;
}
}
- if (*availability)
+ if (availability)
*availability = AVAIL_NOT_AVAILABLE;
return NULL;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ca3b57..189cd39 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/49493
+ * gcc.dg/ipa/ipa-pta-17.c: New testcase.
+
2011-06-22 Jason Merrill <jason@redhat.com>
PR c++/49260
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c
new file mode 100644
index 0000000..e409e4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fipa-pta" } */
+
+static int i;
+extern int j __attribute__ ((alias ("i")));
+int *p = &j;
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index faf4f6a..4127e03 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -2746,6 +2746,18 @@ get_constraint_for_ssa_var (tree t, VEC(ce_s, heap) **results, bool address_p)
return;
}
+ /* For global variables resort to the alias target. */
+ if (TREE_CODE (t) == VAR_DECL
+ && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ {
+ struct varpool_node *node = varpool_get_node (t);
+ if (node && node->alias)
+ {
+ node = varpool_variable_node (node, NULL);
+ t = node->decl;
+ }
+ }
+
vi = get_vi_for_tree (t);
cexpr.var = vi->id;
cexpr.type = SCALAR;
@@ -6703,16 +6715,6 @@ associate_varinfo_to_alias (struct cgraph_node *node, void *data)
return false;
}
-/* Associate node with varinfo DATA. Worker for
- varpool_for_node_and_aliases. */
-static bool
-associate_varinfo_to_alias_1 (struct varpool_node *node, void *data)
-{
- if (node->alias)
- insert_vi_for_tree (node->decl, (varinfo_t)data);
- return false;
-}
-
/* Execute the driver for IPA PTA. */
static unsigned int
ipa_pta_execute (void)
@@ -6744,12 +6746,10 @@ ipa_pta_execute (void)
/* Create constraints for global variables and their initializers. */
for (var = varpool_nodes; var; var = var->next)
{
- varinfo_t vi;
if (var->alias)
continue;
- vi = get_vi_for_tree (var->decl);
- varpool_for_node_and_aliases (var, associate_varinfo_to_alias_1, vi, true);
+ get_vi_for_tree (var->decl);
}
if (dump_file)