summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-14 14:49:13 +0000
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-14 14:49:13 +0000
commitf0ee0b5bd353e28f6da7d966a93f08c9af1e10c5 (patch)
tree9329bdf3c2d31755066d0772b7438f632c1ca28f
parent8dfbf380450e758bdb73324e3233916312dbe076 (diff)
downloadgcc-f0ee0b5bd353e28f6da7d966a93f08c9af1e10c5.tar.gz
2006-02-14 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/26260 * doc/invoke.texi (max-fields-for-field-sensitive): Document param. * params.h (MAX_FIELDS_FOR_FIELD_SENSITIVE): New. * params.def (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE): Ditto. * tree-ssa-structalias.c (create_variable_info_for): Use MAX_FIELDS_FOR_FIELD_SENSITIVE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110972 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/doc/invoke.texi5
-rw-r--r--gcc/params.def10
-rw-r--r--gcc/params.h2
-rw-r--r--gcc/tree-ssa-structalias.c4
5 files changed, 29 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9aec203aa99..9b2bf0ebf36 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2006-02-14 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR tree-optimization/26260
+
+ * doc/invoke.texi (max-fields-for-field-sensitive): Document
+ param.
+ * params.h (MAX_FIELDS_FOR_FIELD_SENSITIVE): New.
+ * params.def (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE): Ditto.
+ * tree-ssa-structalias.c (create_variable_info_for): Use
+ MAX_FIELDS_FOR_FIELD_SENSITIVE.
+
2006-02-14 Zdenek Dvorak <dvorakz@suse.cz>
* doc/invoke.texi (-fprefetch-loop-arrays, -fprefetch-loop-arrays-rtl):
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5c7ff5ebeae..c62aa7b4261 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6195,6 +6195,11 @@ protection when @option{-fstack-protection} is used.
@item max-jump-thread-duplication-stmts
Maximum number of statements allowed in a block that needs to be
duplicated when threading jumps.
+
+@item max-fields-for-field-sensitive
+Maximum number of fields in a structure we will treat in
+a field sensitive manner during pointer analysis.
+
@end table
@end table
diff --git a/gcc/params.def b/gcc/params.def
index 33fa4441cde..ba139d2948b 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -558,7 +558,15 @@ DEFPARAM (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS,
"max-jump-thread-duplication-stmts",
"Maximum number of statements allowed in a block that needs to be duplicated when threading jumps",
15, 0, 0)
-
+
+/* This is the maximum number of fields a variable may have before the pointer analysis machinery
+ will stop trying to treat it in a field-sensitive manner.
+ There are programs out there with thousands of fields per structure, and handling them
+ field-sensitively is not worth the cost. */
+DEFPARAM (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE,
+ "max-fields-for-field-sensitive",
+ "Maximum number of fields in a structure before pointer analysis treats the structure as a single variable",
+ 100, 0, 0)
/*
Local variables:
mode:c
diff --git a/gcc/params.h b/gcc/params.h
index f64193982b4..aafafe17ff3 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -147,4 +147,6 @@ typedef enum compiler_param
PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
+#define MAX_FIELDS_FOR_FIELD_SENSITIVE \
+ ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
#endif /* ! GCC_PARAMS_H */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 2ddbe0f7ff7..c7eae967fc7 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -3881,7 +3881,6 @@ check_for_overlaps (VEC (fieldoff_s,heap) *fieldstack)
}
return false;
}
-
/* Create a varinfo structure for NAME and DECL, and add it to VARMAP.
This will also create any varinfo structures necessary for fields
of DECL. */
@@ -3945,7 +3944,8 @@ create_variable_info_for (tree decl, const char *name)
if (use_field_sensitive
&& !notokay
&& !vi->is_unknown_size_var
- && var_can_have_subvars (decl))
+ && var_can_have_subvars (decl)
+ && VEC_length (fieldoff_s, fieldstack) <= MAX_FIELDS_FOR_FIELD_SENSITIVE)
{
unsigned int newindex = VEC_length (varinfo_t, varmap);
fieldoff_s *fo = NULL;