[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Refactoring calcul stride
Mikael Morin
mikael@gcc.gnu.org
Mon Sep 22 09:41:42 GMT 2025
https://gcc.gnu.org/g:42765006f6f56184812ad8dedc6d3ce53e076079
commit 42765006f6f56184812ad8dedc6d3ce53e076079
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Tue Sep 16 21:59:37 2025 +0200
Refactoring calcul stride
Diff:
---
gcc/fortran/trans-array.cc | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index b0b9ded363de..e094f7fb58b5 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3539,7 +3539,6 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
tree index;
tree desc;
tree data;
- tree stride = NULL_TREE;
info = &ss->info->data.array;
@@ -3619,32 +3618,29 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
gcc_assert (se->loop);
index = se->loop->loopvar[se->loop->order[i]];
- /* Pointer functions can have stride[0] different from unity.
- Use the stride returned by the function call and stored in
- the descriptor for the temporary. */
- if (se->ss && se->ss->info->type == GFC_SS_FUNCTION
- && se->ss->info->expr
- && se->ss->info->expr->symtree
- && se->ss->info->expr->symtree->n.sym->result
- && se->ss->info->expr->symtree->n.sym->result->attr.pointer)
- stride = gfc_conv_descriptor_stride_get (info->descriptor,
- gfc_rank_cst[dim]);
-
if (info->delta[dim] && !integer_zerop (info->delta[dim]))
index = fold_build2_loc (input_location, PLUS_EXPR,
gfc_array_index_type, index, info->delta[dim]);
}
- if (stride == NULL_TREE)
- {
- if (ss->loop == se->loop
- && se->loop->nested == nullptr
- && ss->nested_ss == nullptr
- && i == 0)
- stride = info->stride0;
- else
- stride = gfc_conv_array_stride (info->descriptor, dim);
- }
+ tree stride;
+ if (i == 0
+ && ss->loop == se->loop
+ && se->loop->nested == nullptr
+ && ss->nested_ss == nullptr
+ && !(ar == nullptr
+ /* Pointer functions can have stride[0] different from unity.
+ Use the stride returned by the function call and stored in
+ the descriptor for the temporary in that case. */
+ && se->ss
+ && se->ss->info->type == GFC_SS_FUNCTION
+ && se->ss->info->expr
+ && se->ss->info->expr->symtree
+ && se->ss->info->expr->symtree->n.sym->result
+ && se->ss->info->expr->symtree->n.sym->result->attr.pointer))
+ stride = info->stride0;
+ else
+ stride = gfc_conv_array_stride (info->descriptor, dim);
return conv_array_index_dim (&info->current_elem, index, stride);
}
More information about the Gcc-cvs
mailing list