This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add VIEW_CONVERT_EXPR to operand_equal_p
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>,Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 31 Oct 2015 18:56:33 +0100
- Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p
- Authentication-results: sourceware.org; auth=none
- References: <20151014162944 dot GE16672 at kam dot mff dot cuni dot cz> <1739286 dot yXNLCe3m6q at polaris> <20151030151759 dot GJ37773 at kam dot mff dot cuni dot cz> <1693727 dot sAndYEapaL at polaris>
On October 31, 2015 6:17:35 PM GMT+01:00, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Lets go with this patch and hopefully stabilize the tree. I don't
>think the
>> vector conversions represent an important case.
>
>Unfortunately the patch introduces GIMPLE checking failures in Ada so
>it will
>need to be completed/improved. But let's postpone it because we have
>another
>class of GIMPLE checking failures introduced by the
>useless_type_conversion_p
>change itself:
>
>c37213j.adb:21:05: warning: variable "X" is read but never assigned
>c37213j.adb: In function 'C37213J.PROC.CONSTPROP':
>c37213j.adb:41:4: error: invalid conversion in gimple call
>struct c37213j__proc__value___PAD
>
>struct c37213j__proc__value___PAD
>
># .MEM_38 = VDEF <.MEM_37>
>MEM[(struct c37213j__proc__value___PAD *)R.12_25] = c37213j.proc.value
>();
>[static-chain: &FRAME.39] [return slot optimization]
>
>and:
>
>eric@polaris:~/build/gcc/native> ~/install/gnat-head/bin/gcc -S
>c37213j.adb -
>O2
>c37213j.adb:21:05: warning: variable "X" is read but never assigned
>c37213j.adb: In function 'C37213J.PROC.VALUE':
>c37213j.adb:26:5: error: invalid conversion in return statement
>struct c37213j__proc__value___PAD
>
>struct c37213j__proc__value___PAD
>
># VUSE <.MEM_11>
>return _9(D);
>
>What happens here is that GIMPLE statements are remapped through
>cloning and
>we have a variably-modified type returned by a nested function, so the
>type of
>the LHS of a GIMPLE_CALL or that of the RHS of a GIMPLE_RETURN is
>remapped but
>of course not the return type of the function. This used to be OK
>because
>remapping is done by means of copy_node and preserves TYPE_CANONICAL,
>so the
>conversion between remapped and original type was deemed useless; now
>the
>TYPE_CANONICAL check is gone so the conversion is not useless
>anymore...
>
>I don't think that we want to introduce an artificial VCE to fix this
>so we
>probably need a couple of kludges in the GIMPLE verifier instead.
>
>In any case, the more I look into the fallout of the
>useless_type_conversion_p
>change, the more I find it ill-advised. We used to have a solid type
>system
>in the middle-end by means of the predicate and now we have cases for
>which it
>ought to return false and returns true (e.g. non-structurally
>equivalent types
>with different calling conventions) and cases for which it can return
>true and
>returns false (remapped types or types deemed equivalent by the
>languages).
>I don't really know what it was made for, but there must be a better
>way...
I suggest to re-instantiate the canonical type checks for the aggregate type case.
And add all these test cases.
Richard.
>
> * gnat.dg/discr45.adb: New test.