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]

The road to fixing 16306


This is the first of two parts for fixing 16306, a regression where we
decide to copy-prop a non-restricted pointer into a restricted one,
losing the restrict information in the process.

This is part one because out-of-ssa coalesces the variables as well,
causing the regression to still occur.
However, i'm unclear on how to fix out-of-ssa (in a way that isn't a
complete hack).

For DOM, it suffices to just tell it to not copy-prop from a
non-restrict qualified pointer into a restrict qualified one.

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

Okay for mainline?


2004-12-25  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-dom.c (record_equivalences_from_stmt): Don't copy-prop from a 
	non-restrict qualified type into a restricted one.
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.80
diff -u -p -r2.80 tree-ssa-dom.c
--- tree-ssa-dom.c	13 Dec 2004 20:12:33 -0000	2.80
+++ tree-ssa-dom.c	26 Dec 2004 00:09:57 -0000
@@ -2645,7 +2645,8 @@ record_equivalences_from_stmt (tree stmt
   if (lhs_code == SSA_NAME)
     {
       tree rhs = TREE_OPERAND (stmt, 1);
-
+      tree rhstype = TREE_TYPE (rhs);
+      tree lhstype = TREE_TYPE (lhs);
       /* Strip away any useless type conversions.  */
       STRIP_USELESS_TYPE_CONVERSION (rhs);
 
@@ -2657,7 +2658,10 @@ record_equivalences_from_stmt (tree stmt
 	 just costs time and space.  */
       if (may_optimize_p
 	  && (TREE_CODE (rhs) == SSA_NAME
-	      || is_gimple_min_invariant (rhs)))
+	      || is_gimple_min_invariant (rhs))
+	  /* Don't copy-prop a non-restricted type into a restricted one, but
+	     allow the reverse.  */
+	  && (TYPE_RESTRICT (lhstype) <= TYPE_RESTRICT (rhstype)))
 	SSA_NAME_VALUE (lhs) = rhs;
 
       /* alloca never returns zero and the address of a non-weak symbol

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