This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add fir.constc conversion
ClosedPublic

Authored by rovka on Nov 16 2021, 11:55 PM.

Details

Summary

Add the codegen for fir.constc.

This patch 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 16 2021, 11:55 PM
rovka requested review of this revision.Nov 16 2021, 11:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2021, 11:55 PM
awarzynski added inline comments.Nov 17 2021, 12:43 AM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
589

Could you add a short comment for this struct?

599–606

It would really help me to understand the logic here if the names were more descriptive :) For example, what's ri and ii? And what's the difference between r and rr?

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

[nit] How about different KIND?

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

I think we do not have this op in fir-ops.fir where we check all the ops. Could you add a similar one there as well?

tschuett added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
1714

Would it help to put // clang-format off around this block, with one entry per line. It is hard to see the real diff.

clementval added inline comments.Nov 17 2021, 2:15 AM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
1714

It's changing a lot recently because we are upstreaming the conversion patterns. Once we are done it will not change much so I don't think we need to format it differently.

rovka updated this revision to Diff 387880.Nov 17 2021, 2:26 AM

+ comment
+ test for kind = 8 (I don't think we need to cover all of them here, all the other complex ops only use kind = 16)
+ (hopefully) better names for variables

rovka added inline comments.Nov 17 2021, 2:27 AM
flang/test/Fir/convert-to-llvm.fir
695

Great idea, I'll send a separate patch because we actually hit an unreachable while printing constc

rovka updated this revision to Diff 387884.Nov 17 2021, 2:37 AM

Rebase so the premerge CI can run.

LGTM.

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

OK

This revision is now accepted and ready to land.Nov 17 2021, 3:48 AM
awarzynski accepted this revision.Nov 17 2021, 8:30 AM

LGTM, thanks for addressing my comments!

This revision was automatically updated to reflect the committed changes.