This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Make TREE_OVERFLOWed constant gimple_min_invariant
- From: Jeffrey A Law <law at redhat dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Mar 2005 07:21:50 -0700
- Subject: Re: [patch] Make TREE_OVERFLOWed constant gimple_min_invariant
- Organization: Red Hat, Inc
- References: <20050311110003.GA31228@atrey.karlin.mff.cuni.cz>
- Reply-to: law at redhat dot com
On Fri, 2005-03-11 at 12:00 +0100, Zdenek Dvorak wrote:
> Hello,
>
> TREE_OVERFLOWed constants are not considered gimple_min_invariant
> now, thus limiting the optimizations performed on them (constant
> propagation etc.). This was introduced (as far as I recall -- it's
> more than year now), since having TREE_OVERFLOWed constants in arguments
> of COND_EXPR exposed some problems in tree->rtl expansion. It seems
> likely that these problems were fixed as a side effect of cfg preserving
> tree->rtl expansion. At the very least, removing the TREE_OVERFLOW
> check from gimple_min_invariant exposes just two clearly unrelated problems:
>
> 1) find_taken_edge_cond_expr assumes that integer constant is either
> integer_nonzerop or integer_zerop, which is not true for
> TREE_OVERFLOWed constants.
> 2) We produce a wrongly typed expression in fortran, which confuses ccp.
>
> This patch removes the restriction from is_gimple_min_invariant and
> fixes the described problems.
>
> Bootstrapped & regtested on i686 and x86_64.
>
> Zdenek
>
> * tree-cfg.c (find_taken_edge_cond_expr): Use zero_p instead of
> integer_zerop.
> * tree-gimple.c (is_gimple_min_invariant): Consider overflowed
> constants invariant.
>
> * fortran/trans-intrinsic.c (gfc_conv_intrinsic_ishft): Convert
> the argument of the shift to the unsigned type.
Approved.
Thanks,
Jeff