This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Fixed array constructor lowering.
ClosedPublic

Authored by vzakhari on May 4 2023, 6:30 PM.

Details

Summary

First issue is that the clean-ups were generated after the yield_element
operation that must be the terminator. Second issue is that codegen for
elemenal operation was not working properly with nested elemental ops.

Diff Detail

Event Timeline

vzakhari created this revision.May 4 2023, 6:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2023, 6:30 PM
vzakhari requested review of this revision.May 4 2023, 6:30 PM
jeanPerier accepted this revision.May 5 2023, 12:07 AM

Thanks a lot for figuring out the issue here and fixing this!

flang/lib/Optimizer/Builder/HLFIRTools.cpp
749

I agree.
This would not simplify the bufferize pass situation with YieldOp, right ? As I understand it occurs when a YieldElementOp is clone as part of an hlfir::ElementalOp cloning.

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

It could also simply be unconditionally legal (target.addLegalOp<hlfir::YieldElementOp>, and removed from the target.addIllegalOp list) since it has no pattern anyway as you point out, and that the verifier would still complain if one remains after the pass since it has the HasParent<ElementalOp> trait and hlfir::ElementalOp is illegal here.

This revision is now accepted and ready to land.May 5 2023, 12:07 AM
vzakhari added inline comments.May 5 2023, 8:25 AM
flang/lib/Optimizer/Builder/HLFIRTools.cpp
749

Yes, it would not change much for the bufferize pass, except that it will not have to erase the cloned YieldElementOp.

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

Thank you! This makes sense.

vzakhari updated this revision to Diff 519906.May 5 2023, 9:53 AM
This revision was landed with ongoing or failed builds.May 5 2023, 10:09 AM
This revision was automatically updated to reflect the committed changes.