[PATCH 1/3] Fix PR46029: reimplement if-convert stores.

Richard Guenther richard.guenther@gmail.com
Mon Jan 3 21:52:00 GMT 2011


On Mon, Jan 3, 2011 at 9:26 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi Richi,
>
> On Tue, Nov 16, 2010 at 08:09, Richard Guenther <rguenther@suse.de> wrote:
>> On Tue, 16 Nov 2010, Richard Guenther wrote:
>>
>>> On Mon, 15 Nov 2010, Sebastian Pop wrote:
>>>
>>> > Hi Richi,
>>> >
>>> > fixes to your review are posted separately, see below for the details.
>>> > See 0001-Fix-PR46029-reimplement-if-convert-stores.patch for the
>>> > combined patch.
>>>
>>> +  tree base = create_tmp_var (array_type, "scratch_pad");
>>> +  tree a0 = build4 (ARRAY_REF, elt_type, base, integer_zero_node,
>>> NULL_TREE,
>>> +                   NULL_TREE);
>>>
>>> you can drop creating the ARRAY_REF and do
>>>
>>> +  return insert_address_of (base, build_pointer_type (elt_type), &gsi);
>>>
>>>
>>> The patches are ok with the above change.
>>
>> Btw, in insert_address_of you might want to add
>>
>>  struct ptr_info_def *pi = get_ptr_info (address_of_ai);
>>  pt_solution_set_var (&pi->pt, SSA_NAME_VAR (address_of_ai));
>>
>
> In four tests of the SPEC benchmarks I am getting this kind of errors:
>
> results.f:19:0: error: address taken, but ADDRESSABLE bit not set
> scratch_pad.1438
> f951: note: in statement
> _ifc_.1454_733 = [cond_expr] D.2525_407 != 0 ? _ifc_.1453_797 :
> &scratch_pad.1438;
>
> results.f:19:0: error: address taken, but ADDRESSABLE bit not set
> vkl
> f951: note: in statement
> _ifc_.1450_7837 = [cond_expr] prephitmp.1376_7987 > 1 ? &vkl[11] :
> &scratch_pad.1438;
>
> If I'm watching the addressable field of the vkl or scratch_pad decls,
> I see that TREE_ADDRESSABLE is cleared in maybe_optimize_var
>
>  if (TREE_ADDRESSABLE (var)
>      /* Do not change TREE_ADDRESSABLE if we need to preserve var as
>         a non-register.  Otherwise we are confused and forget to
>         add virtual operands for it.  */
>      && (!is_gimple_reg_type (TREE_TYPE (var))
>          || !bitmap_bit_p (not_reg_needs, DECL_UID (var))))
>    {
>      TREE_ADDRESSABLE (var) = 0;
>
> this is in pass_fold_builtins executed after the loop optimizer is done.
> If I'm disabling this optimization, the above ICE disappears.
> Any idea how to fix this issue?

walk_stmt_load_store_addr_ops needs to handle COND_EXPRs in
the gimple_assign_single_p () visit_addr case.

Of course COND_EXPRs should be moved to non-single RHS at some point.

Richard.

> Thanks,
> Sebastian
>
> PS: With the previous code building an alloca call to allocate the scratch_pad,
> I do not see the ICE on the scratch_pad.1438 but I still see the other error
> on the vkl array.
>



More information about the Gcc-patches mailing list