This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Generate temporary storage in Forall/Where [2/2]
ClosedPublic

Authored by jeanPerier on May 23 2023, 1:20 PM.

Details

Summary

Generate temporary storage inside WHERE and FORALL using the temporary
stack runtime. This covers all cases outside of LHS temporary, where the
descriptor stack will have to be used.

Depends on D151247

Diff Detail

Event Timeline

jeanPerier created this revision.May 23 2023, 1:20 PM
jeanPerier requested review of this revision.May 23 2023, 1:20 PM
  • Rebase to fix test failure
  • In some cases, the runtime stack strategy might be used to stack i1 scalars (because the total number of iteration is unknown). Fortran descriptors cannot be created for i1: it is not a Fortran type. Use fir.logical<1> to communicate the value from/to the runtime in this case. Add related regression test.
This revision is now accepted and ready to land.May 24 2023, 12:51 PM
tblah added inline comments.May 25 2023, 3:21 AM
flang/lib/Optimizer/Builder/TemporaryStorage.cpp
215

How about testing the type you get back against valueStaticType to see if they are different? That way, conversions other than i1 -> fir.logical can be handled.

Thanks for the review

flang/lib/Optimizer/Builder/TemporaryStorage.cpp
215

Good point, I merged this before seeing you comment, update in: https://reviews.llvm.org/D151428