This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support for full redundancy elimination and VN of virtualoperands in GVN-PRE


On Tue, 2004-06-29 at 17:36, Andreas Schwab wrote:

> /tmp/cvs/gcc-test-200406290400/Build/gcc/xgcc -B/tmp/cvs/gcc-test-200406290400/Build/gcc/ -B/usr/local/ia64-suse-linux/bin/ -B/usr/local/ia64-suse-linux/lib/ -isystem /usr/local/ia64-suse-linux/include -isystem /usr/local/ia64-suse-linux/sys-include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DGC_LINUX_THREADS=1 -D_REENTRANT=1 -DTHREAD_LOCAL_ALLOC=1 -DNO_EXECUTE_PERMISSION=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSILENT=1 -DNO_SIGNALS=1 -DALL_INTERIOR_POINTERS=1 -DJAVA_FINALIZATION=1 -DGC_GCJ_SUPPORT=1 -DATOMIC_UNCOLLECTABLE=1 -I/tmp/cvs/gcc-test-200406290400/boehm-gc/include -O2 -O2 -g -fexceptions -I././targ-include -I.//libc/include -O2 -O2 -g -fexceptions -I././targ-include -I.//libc/include -c ../../../boehm-gc/os_dep.c  -fPIC -DPIC -o .libs/os_dep.o
> ../../../boehm-gc/os_dep.c: In function `GC_print_callers':
> ../../../boehm-gc/os_dep.c:3968: internal compiler error: in find_or_generate_expression, at tree-ssa-pre.c:1170
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> make[2]: *** [os_dep.lo] Error 1
> 
Indeed.  This is a fall out from value numbering cast operations.  This
code has an operation (long int)&sym which causes the insertion code in
PRE to try to lookup &sym in its sets.

We abort in find_or_generate_expression because find_leader returns NULL
on &sym and so f_o_g_e thinks that the expression must be complex and
it's not expecting an ADDR_EXPR.

We seem to want to distinguish gimple_min_invariants from _CST nodes
very explicitly in tree-ssa-pre.c.  I'm not sure why.  Since
add_to_value is never called for &sym, we never set TREE_CONSTANT on it,
so no check for TREE_CONSTANT succeeds and since it's not a _CST node,
all the rest of the code thinks that &sym is a non-constant expression.

By using is_gimple_min_invariant everywhere we expect _CST, I can
compile boehm-gc without a glitch.  Dan, I'm sure I'm missing something
so I don't want to offer this patch as a fix.  Why do we work hard at
distinguishing is_gimple_min_invariant from _CST nodes?

I am going to be away from Jul01 to Jul04, so if this patch is not
workable, please feel free to undo my VN changes and I'll deal with the
problem after I return.


Thanks.  Diego.


Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.19
diff -d -c -p -d -u -p -r2.19 tree-ssa-pre.c
--- tree-ssa-pre.c	29 Jun 2004 01:53:03 -0000	2.19
+++ tree-ssa-pre.c	30 Jun 2004 00:54:45 -0000
@@ -566,7 +566,7 @@ static bool
 set_contains_value (value_set_t set, tree val)
 {
   /* All true constants are in every set.  */
-  if (TREE_CODE_CLASS (TREE_CODE (val)) == 'c')
+  if (is_gimple_min_invariant (val))
     return true;
   /* This is only referring to the flag above that we set on
      values referring to invariants, because we know that we
@@ -679,7 +679,7 @@ value_insert_into_set (value_set_t set, 
 
   /* Constant and invariant values exist everywhere, and thus,
      actually keeping them in the sets is pointless.  */
-  if (TREE_CONSTANT (val))
+  if (is_gimple_min_invariant (expr))
     return;
 
   if (!set_contains_value (set, val))
@@ -881,7 +881,7 @@ find_leader (value_set_t set, tree val)
     return NULL;
 
   /* True constants represent themselves.  */
-  if (TREE_CODE_CLASS (TREE_CODE (val)) == 'c')
+  if (is_gimple_min_invariant (val))
     return val;
 
   /* Invariants are still represented by values, since they may be
Index: tree-vn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vn.c,v
retrieving revision 2.2
diff -d -c -p -d -u -p -r2.2 tree-vn.c
--- tree-vn.c	29 Jun 2004 01:53:03 -0000	2.2
+++ tree-vn.c	30 Jun 2004 00:54:45 -0000
@@ -214,7 +214,7 @@ vn_lookup (tree expr, vuse_optype vuses)
   void **slot;
   struct val_expr_pair_d vep = {NULL, NULL, NULL, 0};
 
-  if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c')
+  if (is_gimple_min_invariant (expr))
     return expr;
   vep.e = expr;
   vep.vuses = vuses;
@@ -268,7 +268,7 @@ get_value_handle (tree expr)
 {
   if (TREE_CODE (expr) == SSA_NAME)
     return SSA_NAME_VALUE (expr);
-  else if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c')
+  else if (is_gimple_min_invariant (expr))
     return expr;
   else if (EXPR_P (expr) || DECL_P (expr))
     {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]