fortran, v2: Fix up pasto in gfc_get_array_descr_info
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
Commit Message
On Thu, Aug 01, 2024 at 12:12:38PM +0200, Mikael Morin wrote:
> Yes, I've always wondered how much of a win these integer_zerop checks were,
> probably not that much. In the cases we know they are useless, let's remove
> them (patch pre-approved for gfc_get_array_descr_info).
>
> > Anyway, the following patch just does the minimal change,
> > bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> >
> Looks good, but as said removing the check seems preferable.
The following patch does that.
I've left the
t = base_decl;
if (!integer_zerop (data_off))
t = fold_build_pointer_plus (t, data_off);
earlier in, because at least in the current ABI data_off is always 0 and
integer_zerop is less expensive than getting through match.pd to find out
that POINTER_PLUS_EXPR something 0 is something, there are no other
integer_zerop calls in that file.
2024-08-01 Jakub Jelinek <jakub@redhat.com>
* trans-types.cc (gfc_get_array_descr_info): Don't test if
!integer_zerop (dtype_off), use fold_build_pointer_plus
unconditionally.
Jakub
Comments
Le 01/08/2024 à 12:30, Jakub Jelinek a écrit :
> On Thu, Aug 01, 2024 at 12:12:38PM +0200, Mikael Morin wrote:
>> Yes, I've always wondered how much of a win these integer_zerop checks were,
>> probably not that much. In the cases we know they are useless, let's remove
>> them (patch pre-approved for gfc_get_array_descr_info).
>>
>>> Anyway, the following patch just does the minimal change,
>>> bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>>>
>> Looks good, but as said removing the check seems preferable.
>
> The following patch does that.
>
> I've left the
> t = base_decl;
> if (!integer_zerop (data_off))
> t = fold_build_pointer_plus (t, data_off);
> earlier in, because at least in the current ABI data_off is always 0 and
> integer_zerop is less expensive than getting through match.pd to find out
> that POINTER_PLUS_EXPR something 0 is something, there are no other
> integer_zerop calls in that file.
>
OK (again).
Thanks for the patch.
> 2024-08-01 Jakub Jelinek <jakub@redhat.com>
>
> * trans-types.cc (gfc_get_array_descr_info): Don't test if
> !integer_zerop (dtype_off), use fold_build_pointer_plus
> unconditionally.
>
> --- gcc/fortran/trans-types.cc.jj 2024-08-01 10:25:38.674615970 +0200
> +++ gcc/fortran/trans-types.cc 2024-08-01 12:21:48.611602807 +0200
> @@ -3599,14 +3599,11 @@ gfc_get_array_descr_info (const_tree typ
> {
> rank = 1;
> info->ndimensions = 1;
> - t = base_decl;
> - if (!integer_zerop (dtype_off))
> - t = fold_build_pointer_plus (t, dtype_off);
> + t = fold_build_pointer_plus (base_decl, dtype_off);
> dtype = TYPE_MAIN_VARIANT (get_dtype_type_node ());
> field = gfc_advance_chain (TYPE_FIELDS (dtype), GFC_DTYPE_RANK);
> rank_off = byte_position (field);
> - if (!integer_zerop (dtype_off))
> - t = fold_build_pointer_plus (t, rank_off);
> + t = fold_build_pointer_plus (t, rank_off);
>
> t = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (field)), t);
> t = build1 (INDIRECT_REF, TREE_TYPE (field), t);
>
>
> Jakub
>
@@ -3599,14 +3599,11 @@ gfc_get_array_descr_info (const_tree typ
{
rank = 1;
info->ndimensions = 1;
- t = base_decl;
- if (!integer_zerop (dtype_off))
- t = fold_build_pointer_plus (t, dtype_off);
+ t = fold_build_pointer_plus (base_decl, dtype_off);
dtype = TYPE_MAIN_VARIANT (get_dtype_type_node ());
field = gfc_advance_chain (TYPE_FIELDS (dtype), GFC_DTYPE_RANK);
rank_off = byte_position (field);
- if (!integer_zerop (dtype_off))
- t = fold_build_pointer_plus (t, rank_off);
+ t = fold_build_pointer_plus (t, rank_off);
t = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (field)), t);
t = build1 (INDIRECT_REF, TREE_TYPE (field), t);