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
On Thu, 28 Feb 2008, Andrew Pinski wrote:
> 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.
At least at the moment we don't seem to make use of those ranges in
VRP, but you are right; I'll add such check.
Richard.
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex