This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add fir.convert op conversion from FIR to LLVM IR
ClosedPublic

Authored by clementval on Nov 9 2021, 12:38 AM.

Details

Summary

Add conversion pattern for the fir.convert operation.

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

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

Diff Detail

Event Timeline

clementval created this revision.Nov 9 2021, 12:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 12:38 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Nov 9 2021, 12:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 12:38 AM
rovka accepted this revision.Nov 9 2021, 1:02 AM

LGTM

This revision is now accepted and ready to land.Nov 9 2021, 1:02 AM

Makes sense, I've left a few small suggestions. Thanks for working on this!

flang/lib/Optimizer/CodeGen/CodeGen.cpp
138

Could you add a comment, e.g. "// Complex to complex conversion"?

161

Could you add a comment? e.g. "Conversion from fp values"

173

Don’t use else after a return

https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

Could you add a comment, e.g. "Conversion from integer types"?

193

Don’t use else after a return

https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

Could you add a comment, e.g. "// Conversion from pointer types"?

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

Missing:

// CHECK-NOT:         %{{.*}} = llvm.trunc %[[ARG0]] : i32 to i32

?

clementval marked 4 inline comments as done.Nov 9 2021, 4:21 AM
clementval added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
173

The guidelines does not apply here.
Comment added.

193

Comment added.

clementval updated this revision to Diff 385772.Nov 9 2021, 4:21 AM
clementval marked 2 inline comments as done.

Address review comments

This revision was landed with ongoing or failed builds.Nov 9 2021, 5:55 AM
This revision was automatically updated to reflect the committed changes.
clementval reopened this revision.Nov 9 2021, 6:22 AM

Patch was truncated for some reason.

This revision is now accepted and ready to land.Nov 9 2021, 6:22 AM
clementval updated this revision to Diff 385796.Nov 9 2021, 6:29 AM

Push version of the patch that is not truncated.

This revision was automatically updated to reflect the committed changes.