This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower simple RETURN statement
ClosedPublic

Authored by clementval on Feb 10 2022, 4:54 AM.

Details

Summary

This patch adds the lowering for the RETURN statement
without alternate returns in the main program or in subroutine
and functions.

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

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

Diff Detail

Event Timeline

clementval created this revision.Feb 10 2022, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2022, 4:54 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Feb 10 2022, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2022, 4:54 AM
flang/lib/Lower/Bridge.cpp
679

Is this branch necessary? The branch seems to be added in 343 of genProcedureExit.

flang/test/Lower/return-statement.f90
16–19

Different kinds of comments in the same test (// vs !). Using ! helps to get the test passing.

flang/lib/Lower/Bridge.cpp
679

Scratch that. It is probably needed for situations like the following code. Can you have a look and add this test instead?

subroutine sub2()
  goto 3
  2 return
  3 goto 2
end
clementval marked 3 inline comments as done.

Address review comment

flang/test/Lower/return-statement.f90
16–19

My bad ...

This revision is now accepted and ready to land.Feb 10 2022, 8:34 AM
This revision was automatically updated to reflect the committed changes.