Message ID | 201101041830.19491.ebotcazou@adacore.com |
---|---|
State | New |
Headers | show |
On Tue, Jan 4, 2011 at 6:30 PM, Eric Botcazou <ebotcazou@adacore.com> wrote: > Hi, > > this is the recent failure of ACATS c62002a at -O2 on platforms that use SJLJ > exceptions, for example the ARM. It's an aliasing issue created by IPA-SRA > whose fix is the equivalent of: > > 2010-07-28 Eric Botcazou <ebotcazou@adacore.com> > > PR tree-optimization/44885 > * tree-sra.c (find_param_candidates): Skip pointer types to arrays > with non-aliased component. > > but for the other special aliasing flag, namely DECL_NONADDRESSABLE_P. > > Tested on i586-suse-linux, OK for the mainline? Ok. Thanks, Richard. > > 2011-01-04 Eric Botcazou <ebotcazou@adacore.com> > > PR tree-optimization/47005 > * tree-sra.c (struct access): Add 'non_addressable' bit. > (create_access): Set it for a DECL_NONADDRESSABLE_P field. > (decide_one_param_reduction): Return 0 if the parameter is passed by > reference and one of the accesses in the group is non_addressable. > > > 2011-01-04 Eric Botcazou <ebotcazou@adacore.com> > > * gnat.dg/opt14.adb: New test. > > > -- > Eric Botcazou >
Index: tree-sra.c =================================================================== --- tree-sra.c (revision 168391) +++ tree-sra.c (working copy) @@ -173,6 +173,9 @@ struct access entirely? */ unsigned total_scalarization : 1; + /* Is this access an access to a non-addressable field? */ + unsigned non_addressable : 1; + /* Is this access currently in the work queue? */ unsigned grp_queued : 1; @@ -815,6 +818,10 @@ create_access (tree expr, gimple stmt, b access->grp_unscalarizable_region = unscalarizable_region; access->stmt = stmt; + if (TREE_CODE (expr) == COMPONENT_REF + && DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1))) + access->non_addressable = 1; + return access; } @@ -3665,13 +3672,18 @@ decide_one_param_reduction (struct acces for (; repr; repr = repr->next_grp) { gcc_assert (parm == repr->base); - new_param_count++; + + /* Taking the address of a non-addressable field is verboten. */ + if (by_ref && repr->non_addressable) + return 0; if (!by_ref || (!repr->grp_maybe_modified && !repr->grp_not_necessarilly_dereferenced)) total_size += repr->size; else total_size += cur_parm_size; + + new_param_count++; } gcc_assert (new_param_count > 0);