summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 16:34:22 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 16:34:22 +0000
commit78a0527a697b05508d333f35080c1a0b36f3fe35 (patch)
tree2852023f84692231142ea669a9e5ceed97a70395 /gcc
parent715d27f548b92947692f686ba6b5d1f51968be00 (diff)
downloadgcc-78a0527a697b05508d333f35080c1a0b36f3fe35.tar.gz
PR bootstrap/44699
* tree-vrp.c (vrp_finalize): Deal with changing num_ssa_names. * gimple-fold.c (gimplify_and_update_call_from_tree): If LHS is a gimple reg, attach the original VDEF to the last store in the sequence. testsuite/ PR bootstrap/44699 * gcc.dg/pr44699.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161614 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple-fold.c24
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr44699.c157
-rw-r--r--gcc/tree-vrp.c7
5 files changed, 193 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e61a630fc3..ff37f0cbcb4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-30 Michael Matz <matz@suse.de>
+
+ PR bootstrap/44699
+ * tree-vrp.c (vrp_finalize): Deal with changing num_ssa_names.
+ * gimple-fold.c (gimplify_and_update_call_from_tree): If LHS is
+ a gimple reg, attach the original VDEF to the last store in the
+ sequence.
+
2010-06-30 Iain Sandoe <iains@gcc.gnu.org>
PR other/44034
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 491611fa782..a1fc0201473 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1133,7 +1133,8 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
if (gimple_vdef (stmt) && laststore)
{
gimple_set_vdef (laststore, gimple_vdef (stmt));
- move_ssa_defining_stmt_for_defs (laststore, stmt);
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
update_stmt (laststore);
}
else
@@ -1150,7 +1151,15 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
gsi_insert_before (si_p, last, GSI_NEW_STMT);
gsi_next (si_p);
}
- if (laststore)
+ if (laststore && is_gimple_reg (lhs))
+ {
+ gimple_set_vdef (laststore, gimple_vdef (stmt));
+ update_stmt (laststore);
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
+ laststore = NULL;
+ }
+ else if (laststore)
{
reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore);
gimple_set_vdef (laststore, reaching_vuse);
@@ -1158,9 +1167,14 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
laststore = NULL;
}
new_stmt = gimple_build_assign (lhs, tmp);
- gimple_set_vuse (new_stmt, reaching_vuse);
- gimple_set_vdef (new_stmt, gimple_vdef (stmt));
- move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ if (!is_gimple_reg (tmp))
+ gimple_set_vuse (new_stmt, reaching_vuse);
+ if (!is_gimple_reg (lhs))
+ {
+ gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt;
+ }
}
gimple_set_location (new_stmt, gimple_location (stmt));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ddc100b8169..136c37b57a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-30 Michael Matz <matz@suse.de>
+
+ PR bootstrap/44699
+ * gcc.dg/pr44699.c: New test.
+
2010-06-30 Bernd Schmidt <bernds@codesourcery.com>
PR tree-optimization/39799
diff --git a/gcc/testsuite/gcc.dg/pr44699.c b/gcc/testsuite/gcc.dg/pr44699.c
new file mode 100644
index 00000000000..601cc78f572
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44699.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+typedef long unsigned int size_t;
+typedef long int intmax_t;
+typedef long unsigned int uintmax_t;
+extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+extern const char *trim_filename (const char *);
+
+static __inline void *
+__inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
+{
+ return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+
+typedef unsigned int hashval_t;
+typedef hashval_t (*htab_hash) (const void *);
+typedef int (*htab_eq) (const void *, const void *);
+typedef void (*htab_del) (void *);
+typedef int (*htab_trav) (void **, void *);
+typedef void *(*htab_alloc) (size_t, size_t);
+typedef void (*htab_free) (void *);
+
+typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
+typedef void (*htab_free_with_arg) (void *, void *);
+struct htab {
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ void ** entries;
+ size_t size;
+ size_t n_elements;
+ size_t n_deleted;
+ unsigned int searches;
+ unsigned int collisions;
+ htab_alloc alloc_f;
+ htab_free free_f;
+ void * alloc_arg;
+ htab_alloc_with_arg alloc_with_arg_f;
+ htab_free_with_arg free_with_arg_f;
+ unsigned int size_prime_index;
+};
+
+typedef struct htab *htab_t;
+enum insert_option {NO_INSERT, INSERT};
+extern void * htab_find (htab_t, const void *);
+extern void ** htab_find_slot (htab_t, const void *, enum insert_option);
+
+enum mode_class { MODE_RANDOM, MODE_CC, MODE_INT, MODE_PARTIAL_INT, MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_FLOAT, MODE_DECIMAL_FLOAT, MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM, MODE_VECTOR_FLOAT, MAX_MODE_CLASS };
+
+static const char *const mode_class_names[MAX_MODE_CLASS] =
+{
+ "MODE_RANDOM", "MODE_CC", "MODE_INT", "MODE_PARTIAL_INT", "MODE_FRACT", "MODE_UFRACT", "MODE_ACCUM", "MODE_UACCUM", "MODE_FLOAT", "MODE_DECIMAL_FLOAT", "MODE_COMPLEX_INT", "MODE_COMPLEX_FLOAT", "MODE_VECTOR_INT", "MODE_VECTOR_FRACT", "MODE_VECTOR_UFRACT", "MODE_VECTOR_ACCUM", "MODE_VECTOR_UACCUM", "MODE_VECTOR_FLOAT"
+};
+struct mode_data
+{
+ struct mode_data *next;
+
+ const char *name;
+ enum mode_class cl;
+ unsigned int precision;
+ unsigned int bytesize;
+ unsigned int ncomponents;
+ unsigned int alignment;
+ const char *format;
+
+ struct mode_data *component;
+ struct mode_data *wider;
+ struct mode_data *wider_2x;
+
+ struct mode_data *contained;
+
+ struct mode_data *next_cont;
+
+ const char *file;
+ unsigned int line;
+ unsigned int counter;
+ unsigned int ibit;
+ unsigned int fbit;
+};
+
+static struct mode_data *modes[MAX_MODE_CLASS];
+static unsigned int n_modes[MAX_MODE_CLASS];
+static struct mode_data *void_mode;
+
+static const struct mode_data blank_mode = {
+ 0, "<unknown>", MAX_MODE_CLASS,
+ -1U, -1U, -1U, -1U,
+ 0, 0, 0, 0, 0, 0,
+ "<unknown>", 0, 0, 0, 0
+};
+
+static htab_t modes_by_name;
+
+static __inline__ struct mode_data *
+find_mode (const char *name)
+{
+ struct mode_data key;
+
+ key.name = name;
+ return (struct mode_data *) htab_find (modes_by_name, &key);
+}
+
+static struct mode_data *
+new_mode (enum mode_class cl, const char *name,
+ const char *file, unsigned int line)
+{
+ struct mode_data *m;
+ static unsigned int count = 0;
+
+ m = find_mode (name);
+ if (m)
+ {
+ error ("%s:%d: duplicate definition of mode \"%s\"",
+ trim_filename (file), line, name);
+ error ("%s:%d: previous definition here", m->file, m->line);
+ return m;
+ }
+
+ m = ((struct mode_data *) xmalloc (sizeof (struct mode_data)));
+ ((__builtin_object_size (m, 0) != (size_t) -1) ? __builtin___memcpy_chk (m, &blank_mode, sizeof (struct mode_data), __builtin_object_size (m, 0)) : __inline_memcpy_chk (m, &blank_mode, sizeof (struct mode_data)));
+ m->cl = cl;
+ m->name = name;
+ if (file)
+ m->file = trim_filename (file);
+ m->line = line;
+ m->counter = count++;
+
+ m->next = modes[cl];
+ modes[cl] = m;
+ n_modes[cl]++;
+
+ *htab_find_slot (modes_by_name, m, INSERT) = m;
+
+ return m;
+}
+
+static void
+make_int_mode (const char *name,
+ unsigned int precision, unsigned int bytesize,
+ const char *file, unsigned int line)
+{
+ struct mode_data *m = new_mode (MODE_INT, name, file, line);
+ m->bytesize = bytesize;
+ m->precision = precision;
+}
+
+static void
+create_modes (void)
+{
+make_int_mode ("HI", -1U, 2, "../../work/gcc/machmode.def", 182);
+}
+
+int
+main (int argc, char **argv)
+{
+ create_modes ();
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 590fa74efc8..3da2dc84e9d 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7315,6 +7315,7 @@ vrp_finalize (void)
size_t i;
prop_value_t *single_val_range;
bool do_value_subst_p;
+ unsigned num = num_ssa_names;
if (dump_file)
{
@@ -7326,10 +7327,10 @@ vrp_finalize (void)
/* We may have ended with ranges that have exactly one value. Those
values can be substituted as any other const propagated
value using substitute_and_fold. */
- single_val_range = XCNEWVEC (prop_value_t, num_ssa_names);
+ single_val_range = XCNEWVEC (prop_value_t, num);
do_value_subst_p = false;
- for (i = 0; i < num_ssa_names; i++)
+ for (i = 0; i < num; i++)
if (vr_value[i]
&& vr_value[i]->type == VR_RANGE
&& vr_value[i]->min == vr_value[i]->max
@@ -7357,7 +7358,7 @@ vrp_finalize (void)
identify_jump_threads ();
/* Free allocated memory. */
- for (i = 0; i < num_ssa_names; i++)
+ for (i = 0; i < num; i++)
if (vr_value[i])
{
BITMAP_FREE (vr_value[i]->equiv);