This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add base of the FIR to LLVM IR pass
ClosedPublic

Authored by clementval on Oct 29 2021, 1:27 PM.

Details

Summary

This patch adds the base of the FIR to LLVM IR Dialect conversion pass.
It currently can convert the following operations:

  • fir.global
  • fir.has_value
  • fir.address_of
  • fir.undefined

This patch is part of the upstreaming effort from fir-dev branch. It does not
cover all FIR operations in order to have small patches. Several patches will
follow to convert other operations.

Diff Detail

Event Timeline

clementval created this revision.Oct 29 2021, 1:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2021, 1:27 PM
clementval requested review of this revision.Oct 29 2021, 1:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2021, 1:27 PM
clementval edited the summary of this revision. (Show Details)Oct 29 2021, 1:28 PM

Remove cse pass from the test.

schweitz accepted this revision.Oct 29 2021, 2:04 PM
This revision is now accepted and ready to land.Oct 29 2021, 2:04 PM
clementval edited the summary of this revision. (Show Details)Oct 29 2021, 2:10 PM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.Oct 31 2021, 10:49 PM
flang/include/flang/Optimizer/CodeGen/CGPasses.td
28

Can you revisit the dependentDialects list?

flang/lib/Optimizer/CodeGen/CodeGen.cpp
47–49

delete? (closing/reopening the anonymous namespace)

74

I think it'd be great to document each of the conversion if possible

95

Isn't this something that should be a fold() on the insert_on_range op instead?

147

String comparison is... sad.
Can you add TODO to update the linkage on the fir global to be an enum instead?
(you may want to reuse the LLVM::Linkage?)

clementval marked 4 inline comments as done.Nov 1 2021, 3:01 AM

Addressed most of the comment in D112918

flang/lib/Optimizer/CodeGen/CodeGen.cpp
74

Added some comment for this conversion.

mehdi_amini added inline comments.Nov 1 2021, 9:16 AM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
95

WDYT of this?

clementval marked 2 inline comments as done.Nov 1 2021, 9:52 AM
clementval added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
95

I'll look at that in a separate patch.

95

As mentioned I'll look at this and issue a separate patch since it's a somewhat bigger change than the others requested. Keep it undone until the patch is up for review.

mehdi_amini added inline comments.Nov 1 2021, 1:37 PM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
95

I think you just hadn't sent the previous comment before, they got sent together :)

clementval marked an inline comment as done.Nov 1 2021, 1:39 PM
clementval added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
95

Sorry. I was seeing the comment and didn't notice it wasn't submitted. Anyway it's on my todo list.