This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower basic function with scalar integer/logical return value
ClosedPublic

Authored by clementval on Feb 14 2022, 2:18 AM.

Details

Summary

This patch allows the lowring of simple empty function with a
scalar integer or logical return value.
The code in ConvertType.cpp is cleaned up as well. This file was landed
together with the initial flang push and lowering was still a prototype
at that time. Some more cleaning will come with follow up patches.

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

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

Diff Detail

Event Timeline

clementval created this revision.Feb 14 2022, 2:18 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Feb 14 2022, 2:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2022, 2:18 AM

Add logical

clementval retitled this revision from [flang] Lower basic function with scalar integer return value to [flang] Lower basic function with scalar integer/logical return value.Feb 14 2022, 6:29 AM
clementval edited the summary of this revision. (Show Details)
PeteSteinfeld accepted this revision.Feb 14 2022, 6:51 AM

Aside from one nit, all builds and tests correctly and looks good.

flang/lib/Lower/ConvertType.cpp
220–221

Are these lines supposed to be here?

This revision is now accepted and ready to land.Feb 14 2022, 6:51 AM
clementval added inline comments.Feb 14 2022, 7:13 AM
flang/lib/Lower/ConvertType.cpp
220–221

Nope. They will be part of a future patch. I'll remove them thanks.

Can you add a test,
-> where result is specified with the result keyword.
-> where there is some control flow in the function.

flang/include/flang/Lower/CallInterface.h
113

Nit: closing ')'. I think this is for input arguments only?

flang/lib/Lower/Bridge.cpp
246

Where is this used?

360–364

Nit: Can this be a TODO for now?

clementval marked 4 inline comments as done.

Address review comments

clementval added inline comments.Feb 14 2022, 11:56 AM
flang/include/flang/Lower/CallInterface.h
113

-1 is passed for the result position. Of course it is mostly used later for the args.

flang/lib/Lower/Bridge.cpp
246

Not used right now. Removed from this patch.