This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Optimize type-punning union accesses to VIEW_CONVERT_EXPRs
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "Richard Guenther" <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, "Daniel Berlin" <dberlin at dberlin dot org>
- Date: Thu, 28 Feb 2008 08:45:31 -0800
- Subject: Re: [PATCH][RFC] Optimize type-punning union accesses to VIEW_CONVERT_EXPRs
- References: <Pine.LNX.4.64.0802281727220.4133@zhemvz.fhfr.qr>
On Thu, Feb 28, 2008 at 8:40 AM, Richard Guenther <rguenther@suse.de> wrote:
> + /* For integral conversions with the same precision or pointer
> + conversions use a NOP_EXPR instead. */
> + if ((INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (op0))
> + && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (op0)))
> + || (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE (op0))))
> + return fold_convert (type, op0);
You need to check to make sure the MIN and MAX are the similar. Ada
uses VIEW_CONVERT_EXPR to convert between the limited range and the
normal range variables so it does not confuse VRP.
Thanks,
Andrew Pinski