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: [PATCH][RFC] Optimize type-punning union accesses to VIEW_CONVERT_EXPRs


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


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