This is an archive of the discontinued LLVM Phabricator instance.

[flang] Use target byte stride in pointer remapping
AbandonedPublic

Authored by clementval on Feb 6 2023, 5:42 AM.

Details

Reviewers
klausler
Summary

Use the targert byte stride in pointer associate
with remapping since the target might have been reboxed
as shown in this example.

p(-1:,-2:) => z(:,1:5)

Diff Detail

Event Timeline

clementval created this revision.Feb 6 2023, 5:42 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 6 2023, 5:42 AM
Herald added a subscriber: sunshaoce. · View Herald Transcript
clementval requested review of this revision.Feb 6 2023, 5:42 AM

I do not think this is possible. The pointer and target may have different rank. So the strides cannot be taken from the target. Pointers with bounds remapping requires the target to be simply contiguous or of rank one:

Fortran 2018 10.2.2.3 point 9: "If bounds-remapping-list appears, it specifies the upper and lower bounds of each dimension of the pointer,and thus the extents; the pointer target shall be simply contiguous (9.5.4) or of rank one"

The following is possible and requires computing the new strides in the runtime as this was done:

subroutine test2(p, z)
 integer, pointer :: p(:, :, :), z(:)
 p(1:4,1:8,1:16) => z(1:1024:2)
end subroutine
clementval abandoned this revision.Feb 6 2023, 6:56 AM

You are right. I did not think this hard enough.