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]

[PATCH]: Fix 252.eon, RTL aliasing issue


It turns out alias.c's nonoverlapping_component_refs_p wants to handle
more cases than we thought it originally did (in particular, it gets
passed component refs with no var_decl in them, that represent
(*pointer).field by saying ".field", and we were getting these wrong in
some cases).

Thus, while we can improve the results of this function, we can't be as
aggressive as we had actually made it, and still always have correct
results.

Thus, this patch moves it back to the "correct" side of things while
still improving the results.  We'll improve the results more when we
have two "regular" component_refs in stage1 of 4.2, since it's a little
late to rework this function the way we nede to.
.
It should see through typedefs now, where it didn't before, but still
give up when it can't find a common type, as it used to.

Bootstrapped and regtested on i686-pc-linux-gnu.  Okay for mainline?

:ADDPATCH backend:
--Dan
2005-07-20  Daniel Berlin  <dberlin@dberlin.org>
	
	* alias.c (nonoverlapping_component_refs_p): Use TYPE_MAIN_VARIANT,
	revert to returning false.

Index: alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/alias.c,v
retrieving revision 1.253
diff -u -p -r1.253 alias.c
--- alias.c	16 Jul 2005 18:56:50 -0000	1.253
+++ alias.c	21 Jul 2005 01:21:44 -0000
@@ -1952,13 +1952,13 @@ nonoverlapping_component_refs_p (tree x,
       do
 	{
 	  fieldx = TREE_OPERAND (x, 1);
-	  typex = DECL_FIELD_CONTEXT (fieldx);
+	  typex = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldx));
 
 	  y = orig_y;
 	  do
 	    {
 	      fieldy = TREE_OPERAND (y, 1);
-	      typey = DECL_FIELD_CONTEXT (fieldy);
+	      typey = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldy));
 
 	      if (typex == typey)
 		goto found;
@@ -1971,7 +1971,7 @@ nonoverlapping_component_refs_p (tree x,
 	}
       while (x && TREE_CODE (x) == COMPONENT_REF);
       /* Never found a common type.  */
-      return true;
+      return false;
 
     found:
       /* If we're left with accessing different fields of a structure,

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