This is the mail archive of the 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: [PATCH]: Latent bug in value numbering (Was Re: latent bug inPRE?)

> Indeed, the patch fixes the problem and I'm happy again ;)
> Thanks for the quick fix,
> Richard.

Here is it again, with a proper changelog.

Bootstrapped and regtested on i686-pc-linux-gnu.

Okay for mainline?

2005-02-15  Daniel Berlin  <>

	* tree-vn.c (get_value_handle): Make sure that given an
	is_gimple_min_invariant expression, we always return it.

Index: tree-vn.c
RCS file: /cvs/gcc/gcc/gcc/tree-vn.c,v
retrieving revision 2.6
diff -u -p -r2.6 tree-vn.c
--- tree-vn.c	25 Sep 2004 14:36:40 -0000	2.6
+++ tree-vn.c	15 Feb 2005 15:13:36 -0000
@@ -267,11 +267,16 @@ vn_lookup_or_add (tree expr, vuse_optype
 /* Get the value handle of EXPR.  This is the only correct way to get
    the value handle for a "thing".  If EXPR does not have a value
-   handle associated, it returns NULL_TREE.  */
+   handle associated, it returns NULL_TREE.  
+   NB: If EXPR is min_invariant, this function is *required* to return EXPR.  */
 get_value_handle (tree expr)
+  if (is_gimple_min_invariant (expr))
+    return expr;
   if (TREE_CODE (expr) == SSA_NAME)
     return SSA_NAME_VALUE (expr);
   else if (EXPR_P (expr) || DECL_P (expr))
@@ -280,10 +285,7 @@ get_value_handle (tree expr)
       return ((ann) ? ann->common.value_handle : NULL_TREE);
-    {
-      gcc_assert (is_gimple_min_invariant (expr));
-      return expr;
-    }
+    gcc_unreachable ();

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