This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix loop optimization bug
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Eric Botcazou" <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 6 Oct 2008 15:55:28 +0200
- Subject: Re: [PATCH] Fix loop optimization bug
- References: <200810061221.03338.ebotcazou@adacore.com>
On Mon, Oct 6, 2008 at 12:21 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression present at -O2 on the mainline and 4.3 branch. For the
> attached testcase, ivopts takes the address of something like
> VIEW_CONVERT_EXPR <PLUS_EXPR <..,..>>
> which results in the creation of a temporary and thus wrong code.
>
> Fixed by teaching may_be_nonaddressable_p about this problematic case. Tested
> on i586-suse-linux, OK for mainline and 4.3 branch?
Can it be your patch is for the 4.3 branch only? Trunk has
case VIEW_CONVERT_EXPR:
/* This kind of view-conversions may wrap non-addressable objects
and make them look addressable. After some processing the
non-addressability may be uncovered again, causing ADDR_EXPRs
of inappropriate objects to be built. */
if (is_gimple_reg (TREE_OPERAND (expr, 0))
|| is_gimple_min_invariant (TREE_OPERAND (expr, 0)))
return true;
and so never should fall through to the default case for
unary/binary expressions. Please adjust the 4.3 branch
to the trunk version instead.
Ok with that change,
Thanks,
Richard.
>
> 2008-10-06 Eric Botcazou <ebotcazou@adacore.com>
>
> * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Return true for
> binary and comparison expressions.
>
>
> 2008-10-06 Eric Botcazou <ebotcazou@adacore.com>
>
> * gnat.dg/loop_optimization4.adb: New test.
> * gnat.dg/loop_optimization4_pkg.ad[sb]: New helper.
>
>
> --
> Eric Botcazou
>