This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Support array section with non constant bounds
ClosedPublic

Authored by clementval on Apr 20 2023, 1:43 PM.

Details

Summary

Add lowering for non constant lower and upper bounds
in array section.

Diff Detail

Event Timeline

clementval created this revision.Apr 20 2023, 1:43 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 20 2023, 1:43 PM
clementval requested review of this revision.Apr 20 2023, 1:43 PM
razvanlupusoru added inline comments.Apr 20 2023, 3:06 PM
flang/test/Lower/OpenACC/acc-enter-data.f90
150–151

I should have caught this yesterday. But I intended for acc.bounds operation to be dialect agnostic. Since it is normally paired with a pointer to data, lowerbound of zero is the default. I will add a comment to the specification.

But basically if array is declared as 1:10, and we want to copy slice 5:10, then the acc.bounds operation is:
acc.bounds lb(4) ub(9) extent(6) startIdx(1)

jeanPerier added inline comments.Apr 21 2023, 2:17 AM
flang/lib/Lower/OpenACC.cpp
144–145

You could also use converter.genExprValue directly. For numerical and logical scalars, this is guaranteed to return the loaded value if this was a variable. It looks like your code is a bit different since you only load fir::ReferenceType, but not fir::PointerType/fir::HeapType, is this desired?

clementval added inline comments.Apr 21 2023, 9:20 AM
flang/lib/Lower/OpenACC.cpp
144–145

I think using converter.genExprValue is fine here. Thanks for pointing me to it.

clementval marked an inline comment as done.Apr 21 2023, 2:17 PM
This revision is now accepted and ready to land.Apr 24 2023, 12:56 AM