This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add !fir.alloca conversion
ClosedPublic

Authored by rovka on Nov 10 2021, 5:18 AM.

Details

Summary

Convert !fir.alloca into !llvm.alloca.

This also contains a fix for verifyInType in FIROps.cpp, to make sure we
don't error out on a !fir.ptr<!fir.array<?xN>> (more context here:
https://github.com/flang-compiler/f18-llvm-project/pull/864).

This is part of the upstreaming effort from fir-dev.

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

Diff Detail

Event Timeline

rovka created this revision.Nov 10 2021, 5:18 AM
rovka requested review of this revision.Nov 10 2021, 5:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2021, 5:18 AM
clementval added inline comments.Nov 10 2021, 9:16 AM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
311

Should it really be a TODO? Maybe an error?

322

We should update auto where is not super clear

324
326–328
rovka updated this revision to Diff 386446.Nov 11 2021, 1:40 AM

Less auto.
Also replace TODO with error, although I'm not sure who should be generating the mem size function. If it's this pass, then TODO sounds better, but if it's supposed to already exist in the module by the time this pass runs then error is more appropriate. Maybe @schweitz or @jeanPerier can chime in.

clementval accepted this revision.Nov 11 2021, 1:43 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Nov 11 2021, 1:43 AM
This revision was landed with ongoing or failed builds.Nov 11 2021, 3:28 AM
This revision was automatically updated to reflect the committed changes.

Less auto.
Also replace TODO with error, although I'm not sure who should be generating the mem size function. If it's this pass, then TODO sounds better, but if it's supposed to already exist in the module by the time this pass runs then error is more appropriate. Maybe @schweitz or @jeanPerier can chime in.

Lowering needs to create the function.

TODO is really an error with a grep-able name. It merely adds the magic text "not yet implemented", but is otherwise the same functionality.