re PR middle-end/17957 (vector type node used after garbage-collected)

2004-11-25  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/17957
        * testsuite/gcc.dg/pr17957.c: New test.

2004-11-25  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/17957
        * tree-complex.c (vector_inner_type): New variable moved from
        build_word_mode_vector_type.
        (vector_last_type): Likewise.
        (vector_last_nunits): Likewise.
        (build_word_mode_vector_type): Use the new variables.
        * Makefile.in (tree-complex.o): Add gt-tree-complex.h $(GGC_H).
        (GTFILES): Add tree-complex.c.
        (gt-tree-complex.h): New rule, add it to the rest of the gt-* rules.

From-SVN: r91322
This commit is contained in:
Andrew Pinski 2004-11-26 03:55:10 +00:00 committed by Andrew Pinski
parent c0b57a5aad
commit 5f0be3d01a
5 changed files with 57 additions and 14 deletions

View File

@ -1,3 +1,15 @@
2004-11-25 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17957
* tree-complex.c (vector_inner_type): New variable moved from
build_word_mode_vector_type.
(vector_last_type): Likewise.
(vector_last_nunits): Likewise.
(build_word_mode_vector_type): Use the new variables.
* Makefile.in (tree-complex.o): Add gt-tree-complex.h $(GGC_H).
(GTFILES): Add tree-complex.c.
(gt-tree-complex.h): New rule, add it to the rest of the gt-* rules.
2004-11-25 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.h (TARGET_CPU_CPP_BUILTINS): Define

View File

@ -1962,7 +1962,7 @@ tree-sra.o : tree-sra.c $(CONFIG_H) system.h errors.h $(TREE_H) $(RTL_H) \
tree-complex.o : tree-complex.c $(CONFIG_H) system.h $(TREE_H) \
$(TM_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) tree-iterator.h tree-pass.h \
$(FLAGS_H) $(OPTABS_H) $(RTL_H) $(MACHMODE_H) $(EXPR_H) \
langhooks.h $(FLAGS_H) $(DIAGNOSTIC_H)
langhooks.h $(FLAGS_H) $(DIAGNOSTIC_H) gt-tree-complex.h $(GGC_H)
df.o : df.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
insn-config.h $(RECOG_H) function.h $(REGS_H) alloc-pool.h hard-reg-set.h \
$(BASIC_BLOCK_H) $(DF_H)
@ -2420,7 +2420,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
$(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
$(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
$(srcdir)/tree-chrec.h \
$(srcdir)/tree-chrec.h $(srcdir)/tree-complex.c \
$(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
$(srcdir)/tree-profile.c $(srcdir)/rtl-profile.c $(srcdir)/tree-nested.c \
$(out_file) \
@ -2439,7 +2439,7 @@ gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dojump.h \
gt-dwarf2out.h gt-ra-build.h gt-reg-stack.h gt-dwarf2asm.h \
gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parse.h \
gt-c-pragma.h gtype-c.h gt-input.h gt-cfglayout.h \
gt-tree-mudflap.h \
gt-tree-mudflap.h gt-tree-complex.h \
gt-tree-ssa-ccp.h gt-tree-eh.h \
gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \
gt-tree-phinodes.h gt-tree-cfg.h gt-tree-nested.h \

View File

@ -1,3 +1,8 @@
2004-11-25 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17957
* testsuite/gcc.dg/pr17957.c: New test.
2004-11-25 Mark Mitchell <mark@codesourcery.com>
PR c++/18445

View File

@ -0,0 +1,18 @@
/* { dg-do compile } */
/* { dg-options "--param ggc-min-expand=0 -param ggc-min-heapsize=0" } */
__attribute__ ((vector_size (64))) unsigned char v1, v2, v3;
void
vadd (void)
{
v1 = v2 + v3;
}
void
test_add (void)
{
vadd ();
}
void
vsub (void)
{
v1 = v2 - v3;
}

View File

@ -35,6 +35,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tree-iterator.h"
#include "tree-pass.h"
#include "flags.h"
#include "ggc.h"
/* Extract the real or imaginary part of a complex variable or constant.
@ -509,25 +510,30 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
return ret;
}
static GTY(()) tree vector_inner_type;
static GTY(()) tree vector_last_type;
static GTY(()) int vector_last_nunits;
/* Return a suitable vector types made of SUBPARTS units each of mode
"word_mode" (the global variable). */
static tree
build_word_mode_vector_type (int nunits)
{
static tree innertype;
static tree last;
static int last_nunits;
if (!innertype)
innertype = lang_hooks.types.type_for_mode (word_mode, 1);
else if (last_nunits == nunits)
return last;
if (!vector_inner_type)
vector_inner_type = lang_hooks.types.type_for_mode (word_mode, 1);
else if (vector_last_nunits == nunits)
{
gcc_assert (TREE_CODE (vector_last_type) == VECTOR_TYPE);
return vector_last_type;
}
/* We build a new type, but we canonicalize it nevertheless,
because it still saves some memory. */
last_nunits = nunits;
last = type_hash_canon (nunits, build_vector_type (innertype, nunits));
return last;
vector_last_nunits = nunits;
vector_last_type = type_hash_canon (nunits,
build_vector_type (vector_inner_type,
nunits));
return vector_last_type;
}
typedef tree (*elem_op_func) (block_stmt_iterator *,
@ -953,3 +959,5 @@ struct tree_opt_pass pass_pre_expand =
| TODO_verify_stmts, /* todo_flags_finish */
0 /* letter */
};
#include "gt-tree-complex.h"