This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Do not call convert() in PRE
On Sun, 13 Jul 2008, Daniel Berlin wrote:
> On Sun, Jul 13, 2008 at 2:34 PM, Richard Guenther <rguenther@suse.de> wrote:
> > On Sun, 13 Jul 2008, Daniel Berlin wrote:
> >
> >> I'm not sure this is true.
> >> If i apply this, I can't bootstrap darwin, so ...
> >
> > Do you have a preprocessed testcase for me to look at? Conversions
> > between int and float should be through FIX_TRUNC_EXPR or FLOAT_EXPR,
> > and if the comment is correct and unions are somehow involved
> > convert()ing is wrong and VIEW_CONVERT_EXPR should be used instead.
> >
>
> Well, you are right, after updating, the problem went away (I had
> minimized it and it is in gcc.c-torture/compile now).
>
> So feel free to commit it.
This is what I committed.
Richard.
2008-07-14 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (insert_into_preds_of_block): Do not call
convert.
Index: tree-ssa-pre.c
===================================================================
*** tree-ssa-pre.c (revision 137779)
--- tree-ssa-pre.c (working copy)
*************** insert_into_preds_of_block (basic_block
*** 2949,2966 ****
our IL requires all operands of a phi node have the same
type. */
tree name = PRE_EXPR_NAME (eprime);
! if (TREE_TYPE (name) != type)
{
tree builtexpr;
tree forcedexpr;
! /* When eliminating casts through unions,
! we sometimes want to convert a real to an integer,
! which fold_convert will ICE on */
! /* if (fold_convertible_p (type, name)) */
! builtexpr = fold_convert (type, name);
! /* else
! builtexpr = convert (type, name);*/
!
forcedexpr = force_gimple_operand (builtexpr,
&stmts, true,
NULL);
--- 2949,2959 ----
our IL requires all operands of a phi node have the same
type. */
tree name = PRE_EXPR_NAME (eprime);
! if (!useless_type_conversion_p (type, TREE_TYPE (name)))
{
tree builtexpr;
tree forcedexpr;
! builtexpr = fold_convert (type, name);
forcedexpr = force_gimple_operand (builtexpr,
&stmts, true,
NULL);