[all-commits] [llvm/llvm-project] 189cb7: [flang] Lower optionals in GET_COMMAND_ARGUMENT an...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Apr 11 00:35:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 189cb7df911b0d1aafbe60bec1a9e921827e9875
      https://github.com/llvm/llvm-project/commit/189cb7df911b0d1aafbe60bec1a9e921827e9875
  Author: jeanPerier <jeanPerier at users.noreply.github.com>
  Date:   2022-04-11 (Mon, 11 Apr 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/FIRBuilder.h
    M flang/include/flang/Optimizer/Builder/Runtime/Command.h
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    M flang/lib/Optimizer/Builder/Runtime/Command.cpp
    A flang/test/Lower/Intrinsics/get_command_argument-optional.f90
    M flang/test/Lower/Intrinsics/get_command_argument.f90
    A flang/test/Lower/Intrinsics/get_environment_variable-optional.f90
    M flang/test/Lower/Intrinsics/get_environment_variable.f90
    M flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp

  Log Message:
  -----------
  [flang] Lower optionals in GET_COMMAND_ARGUMENT and  GET_ENVIRONMENT_VARIABLE

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).

Differential Revision: https://reviews.llvm.org/D123388




More information about the All-commits mailing list