[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Déplacement accumulation index dans conv_array_index_offset
Mikael Morin
mikael@gcc.gnu.org
Wed Sep 17 11:22:27 GMT 2025
https://gcc.gnu.org/g:b0b0e5c834f22e3fb45bcbfd634501f2fd3a8e6d
commit b0b0e5c834f22e3fb45bcbfd634501f2fd3a8e6d
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Tue Sep 16 18:50:18 2025 +0200
Déplacement accumulation index dans conv_array_index_offset
Diff:
---
gcc/fortran/trans-array.cc | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index f2a0d5ffe304..641373d001ad 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3456,7 +3456,7 @@ array_bound_check_elemental (gfc_se * se, gfc_ss * ss, gfc_expr * expr)
dimensions. Single element references are processed separately.
DIM is the array dimension, I is the loop dimension. */
-static tree
+static void
conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
gfc_array_ref * ar, tree stride)
{
@@ -3564,7 +3564,11 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
index = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
index, stride);
- return index;
+ /* Add the offset for this dimension to the stored offset for all other
+ dimensions. */
+ info->element_ref.index = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type,
+ info->element_ref.index, index);
}
@@ -3707,12 +3711,8 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar,
else
n = 0;
- index = conv_array_index_offset (se, ss, ss->dim[n], n, ar, info->stride0);
- /* Add the offset for this dimension to the stored offset for all other
- dimensions. */
- if (info->element_ref.index && !integer_zerop (info->element_ref.index))
- index = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
- index, info->element_ref.index);
+ conv_array_index_offset (se, ss, ss->dim[n], n, ar, info->stride0);
+ index = info->element_ref.index;
base = build_fold_indirect_ref_loc (input_location, info->element_ref.base);
@@ -4018,7 +4018,7 @@ add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss,
{
gfc_se se;
gfc_array_info *info;
- tree stride, index;
+ tree stride;
info = &ss->info->data.array;
@@ -4026,12 +4026,9 @@ add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss,
se.loop = loop;
se.expr = info->descriptor;
stride = gfc_conv_array_stride (info->descriptor, array_dim);
- index = conv_array_index_offset (&se, ss, array_dim, loop_dim, ar, stride);
+ conv_array_index_offset (&se, ss, array_dim, loop_dim, ar, stride);
gfc_add_block_to_block (pblock, &se.pre);
- info->element_ref.index = fold_build2_loc (input_location, PLUS_EXPR,
- gfc_array_index_type,
- info->element_ref.index, index);
info->element_ref.index = gfc_evaluate_now (info->element_ref.index, pblock);
}
More information about the Gcc-cvs
mailing list