This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not use TYPE_CANONICAL in useless_type_conversion
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, gcc-patches at gcc dot gnu dot org, Richard Biener <rguenther at suse dot de>, Bernd Schmidt <bschmidt at redhat dot com>, law at redhat dot com
- Date: Tue, 13 Oct 2015 05:08:51 -0300
- Subject: Re: Do not use TYPE_CANONICAL in useless_type_conversion
- Authentication-results: sourceware.org; auth=none
- References: <20151002214127 dot GC84720 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1510081248520 dot 6516 at zhemvz dot fhfr dot qr> <20151008203036 dot GD90964 at kam dot mff dot cuni dot cz> <1701384 dot N6BZZR1xcT at polaris> <20151009175527 dot GA66084 at kam dot mff dot cuni dot cz>
On Oct 9, 2015, Jan Hubicka <hubicka@ucw.cz> wrote:
> ... we initialize mode to be non-VOIDmode only if the field is not bitfield. I missed
> the flag while looking at the dump. Indeed the DECL_MODE if FIELD_DECL is SImode,
> but it is ignored.
> Hmm, it seems that for CALL_EXPR the register is supposed to be non-BLKmode
> already. So I guess only what we need to do is to consider bifields when
> TEMP is blk mode and then we want to convert? what about this?
How about using in store_bit_field the same logic you added to
store_expr_with_bounds to get input MEMs to have a compatible mode?
This patch was regstrapped on i686-linux-gnu and x86_64-linux-gnu. Ok
to install?
support BLKmode inputs for store_bit_field
From: Alexandre Oliva <aoliva@redhat.com>
Revision 228586 changed useless_type_conversion_p and added mode
changes for MEM:BLKmode inputs in store_expr_with_bounds, but it
missed store_bit_field. This caused ada/rts/s-regpat.ads to fail
compilation on x86_64-linux-gnu.
for gcc/ChangeLog
* expmed.c (store_bit_field_1): Adjust mode of BLKmode inputs.
---
gcc/expmed.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 93cf508..69ea511 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -757,6 +757,14 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
}
}
+ /* 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 (value) == BLKmode && GET_MODE (op0) != BLKmode)
+ {
+ gcc_assert (MEM_P (value));
+ value = adjust_address_nv (value, GET_MODE (op0), 0);
+ }
+
/* Storing an lsb-aligned field in a register
can be done with a movstrict instruction. */
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer