This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR middle-end/33088
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Eric Botcazou" <ebotcazou at libertysurf dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Dec 2007 23:35:24 +0100
- Subject: Re: [PATCH] Fix PR middle-end/33088
- References: <200712122321.48357.ebotcazou@libertysurf.fr>
On Dec 12, 2007 11:21 PM, Eric Botcazou <ebotcazou@libertysurf.fr> wrote:
> As diagnosed by Joseph, this is a problem introduced by RTH's patch
> http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00860.html>
> which promotes partial stores to the real or imaginary part of a complex
> variable to total stores.
>
> This is achieved by generating a load of the other, unmodified part of the
> complex variables just before the total store, thus introducing a load of
> an undefined value if the variable is uninitialized.
>
> This works, i.e. the uninitialized loads are cleaned up, if the fully-fledged
> complex operations lowering pass is run, followed by a DCE pass. The problem
> here is that the lowering pass is not run, even at -O or above, because the
> associated predicate returns false for the function at hand.
>
> The proposed fix is two-pronged: (1) not promoting the partial stores at -O0,
> (2) teaching the predicate to detect the uninitialized loads at -O1 or above.
>
> (1) is achieved by just tweaking is_gimple_reg_type, i.e. DECL_GIMPLE_REG_P is
> still being set on the individual variables. This seems to work, but...
>
> Tested on i586-suse-linux, OK for mainline?
I think the idea and implementation are sound. But, did you verify
that the places
we set DECL_GIMPLE_REG_P in the gimplifier are properly guarded with the
changed predicate? That is, shouldn't the occurances of
if ((TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == VECTOR_TYPE)
...
DECL_GIMPLE_REG_P (parm) = 1;
changed to use the is_gimple_reg_type predicate? (at least in the gimplifier)
Thanks for tackling this bug!
Richard.
> 2007-12-12 Eric Botcazou <ebotcazou@libertysurf.fr>
>
> PR middle-end/33088
> * gimplify.c (gimplify_modify_expr_complex_part): Add note to comment.
> * tree-complex.c (init_dont_simulate_again): Return true if there are
> uninitialized loads generated by gimplify_modify_expr_complex_part.
> * tree-gimple.c (is_gimple_reg_type): Return false for complex types
> if not optimizing.
> * tree-ssa.c (ssa_undefined_value_p): New predicate extracted from...
> (warn_uninit): ...here. Use ssa_undefined_value_p.
> * tree-ssa-pre.c (is_undefined_value): Delete.
> (phi_translate_1): Use ssa_undefined_value_p.
> (add_to_exp_gen): Likewise.
> (make_values_for_stmt): Likewise.
> * tree-flow.h (ssa_undefined_value_p): Declare.
>
>
> 2007-12-12 Eric Botcazou <ebotcazou@libertysurf.fr>
>
> * gcc.dg/uninit-13.c: UnXFAIL.
> * gcc.dg/complex-5.c: New testcase.
>
>
> --
> Eric Botcazou
>