This is an archive of the discontinued LLVM Phabricator instance.

[flang] hlfir.elemental codegen
ClosedPublic

Authored by jeanPerier on Dec 15 2022, 4:43 AM.

Details

Summary

Without any optimization or when it cannot be optimized before
bufferization, an hlfir.elemental lowers to an array temporary.
Its codegen consists in:

  • allocating a temp given the type, shape, and length parameter arguments.
  • generating a loop nest given the elemental shape
  • inlining the body of the elemental inside the loops, and replacing the yield_element by an assignment to an element of the temp.

Diff Detail

Event Timeline

jeanPerier created this revision.Dec 15 2022, 4:43 AM
Herald added a project: Restricted Project. · View Herald Transcript
jeanPerier requested review of this revision.Dec 15 2022, 4:43 AM
This revision is now accepted and ready to land.Dec 15 2022, 11:35 AM

Aside from a couple of nits, all builds and tests correctly and looks good as far as I can tell. But someone with more expertise should approve.

flang/include/flang/Optimizer/Builder/HLFIRTools.h
265

"generates" rather than "generate"

flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
307

"patterns" should read "pattern"

308

"required" should read "requires"

jeanPerier marked 3 inline comments as done.

Fix typos in comments.

Thanks for the review Pete and Valentin.

This revision was automatically updated to reflect the committed changes.