This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR 42898] Do not create SRA piecemeal copies when volatile operands are involved
- From: Richard Guenther <rguenther at suse dot de>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 Feb 2010 13:12:41 +0100 (CET)
- Subject: Re: [PATCH, PR 42898] Do not create SRA piecemeal copies when volatile operands are involved
- References: <20100208121154.GB23561@virgil.suse.cz>
On Mon, 8 Feb 2010, Martin Jambor wrote:
> Hi,
>
> the patch below is the final missing bit required to fix PR 42898 on
> trunk. It simply treats loads/stores to volatile aggregates as those
> with potential type compatibility issues and so does not create any
> extra loads and stores for sub-accesses. It also ignores statements
> with volatile ops when marking aggregates for total scalarization in
> order not to create unnecessary bloat.
>
> Bootstrapped and regression tested on x86_64-linux. OK for trunk?
Ok.
Thanks,
Richard.
> Thanks,
>
> Martin
>
>
> 2010-02-05 Martin Jambor <mjambor@suse.cz>
>
> PR middle-end/42898
> * tree-sra.c (build_accesses_from_assign): Do not mark in
> should_scalarize_away_bitmap if stmt has volatile ops.
> (sra_modify_assign): Do not process assigns piecemeal if if stmt
> has volatile ops.
>
> Index: mine/gcc/tree-sra.c
> ===================================================================
> --- mine.orig/gcc/tree-sra.c
> +++ mine/gcc/tree-sra.c
> @@ -1023,7 +1023,8 @@ build_accesses_from_assign (gimple *stmt
> racc = build_access_from_expr_1 (rhs_ptr, stmt, false);
> lacc = build_access_from_expr_1 (lhs_ptr, stmt, true);
>
> - if (should_scalarize_away_bitmap && racc && !is_gimple_reg_type (racc->type))
> + if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt)
> + && racc && !is_gimple_reg_type (racc->type))
> bitmap_set_bit (should_scalarize_away_bitmap, DECL_UID (racc->base));
>
> if (lacc && racc
> @@ -2648,7 +2649,9 @@ sra_modify_assign (gimple *stmt, gimple_
> there to do the copying and then load the scalar replacements of the LHS.
> This is what the first branch does. */
>
> - if (contains_view_convert_expr_p (rhs) || contains_view_convert_expr_p (lhs)
> + if (gimple_has_volatile_ops (*stmt)
> + || contains_view_convert_expr_p (rhs)
> + || contains_view_convert_expr_p (lhs)
> || (access_has_children_p (racc)
> && !ref_expr_for_all_replacements_p (racc, lhs, racc->offset))
> || (access_has_children_p (lacc)
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex