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: Do not use TYPE_CANONICAL in useless_type_conversion


> Jan Hubicka <hubicka@ucw.cz> writes:
> 
> > Does the patch in https://gcc.gnu.org/ml/gcc-patches/2015-10/msg00902.html help?
> 
> No, it doesn't.
> 
Andreas,
I am sorry for getting late to this. I hoped that the alternative patch by Alexandre would fix this.
I still don't know how to reproduce without IA-64 box, so I am attaching a patch that I think should
fix it.  Does the attached patch work?

Thank you,
Jan

Index: expr.c
===================================================================
--- expr.c	(revision 228851)
+++ expr.c	(working copy)
@@ -6669,9 +6669,16 @@ store_field (rtx target, HOST_WIDE_INT b
 			     GET_MODE_BITSIZE (GET_MODE (temp)) - bitsize,
 			     NULL_RTX, 1);
 
+      /* We allow move between structures of same size but different mode.
+	 If source is in memory and the mode differs, simply change the memory.  */
+      if (GET_MODE (temp) == BLKmode && mode != BLKmode)
+	{ 
+	  gcc_assert (MEM_P (temp));
+	  temp = adjust_address_nv (temp, mode, 0);
+	}
       /* Unless MODE is VOIDmode or BLKmode, convert TEMP to MODE.  */
-      if (mode != VOIDmode && mode != BLKmode
-	  && mode != TYPE_MODE (TREE_TYPE (exp)))
+      else if (mode != VOIDmode && mode != BLKmode
+	       && mode != TYPE_MODE (TREE_TYPE (exp)))
 	temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1);
 
       /* If TEMP is not a PARALLEL (see below) and its mode and that of TARGET


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