This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower optionals in GET_COMMAND_ARGUMENT and GET_ENVIRONMENT_VARIABLE
ClosedPublic

Authored by jeanPerier on Apr 8 2022, 6:50 AM.

Details

Summary

Handle dynamic optional argument in GET_COMMAND_ARGUMENT and GET_ENVIRONMENT_VARIABLE
(previously compiled but caused segfaults). The previous code
handled static presence/absence aspects, but not when an absent dummy optional was
passed to one of the optional intrinsic arguments.

Simplify the runtime call lowering to simply lower the runtime call without
dealing with optionality there. This keeps the optional handling logic in
IntrinsicCall.cpp.

Note that the new code will generate some extra "if (not null addr )/then/else"
when the actual arguments are always there at runtime. That makes the implementation
a lot simpler/safer, and I think it is OK for now (I do not expect these runtime
function to be called in hot loop nests).

Diff Detail

Event Timeline

jeanPerier created this revision.Apr 8 2022, 6:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2022, 6:50 AM
jeanPerier requested review of this revision.Apr 8 2022, 6:50 AM
This revision is now accepted and ready to land.Apr 8 2022, 7:06 AM