This is an archive of the discontinued LLVM Phabricator instance.

[flang][CodeGen] Transform `fir.field_index` to a sequence of LLVM MLIR
ClosedPublic

Authored by awarzynski on Nov 16 2021, 5:21 AM.

Details

Summary

This patch extends the FIRToLLVMLowering pass in Flang by adding a
hook to transform fir.field_index to a sequence of LLVM MLIR
instructions.

This is part of the upstreaming effort from the fir-dev branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>

Diff Detail

Event Timeline

awarzynski created this revision.Nov 16 2021, 5:21 AM
awarzynski requested review of this revision.Nov 16 2021, 5:21 AM
rovka accepted this revision.Nov 16 2021, 11:16 PM

LGTM (with minor nits).

flang/test/Fir/convert-to-llvm.fir
1292

Nit: Can you add another field to the struct and check its index too?

1304

Nit: I think you can get away with just declaring this.

This revision is now accepted and ready to land.Nov 16 2021, 11:16 PM

Incorporate Diana's suggestions

LGTM.

flang/test/Fir/convert-to-llvm.fir
1315

Nit: Just test it on the field m as well.

awarzynski added inline comments.Nov 18 2021, 8:33 AM
flang/test/Fir/convert-to-llvm.fir
1315

Good idea, will do before merging!