[all-commits] [llvm/llvm-project] bb8bf8: [flang] add internal_assoc flag to mark variable c...

jeanPerier via All-commits all-commits at lists.llvm.org
Tue Nov 26 00:21:34 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb8bf858e865ec3119352bdef43c09adb4c93b31
      https://github.com/llvm/llvm-project/commit/bb8bf858e865ec3119352bdef43c09adb4c93b31
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-11-26 (Tue, 26 Nov 2024)

  Changed paths:
    M flang/include/flang/Lower/AbstractConverter.h
    M flang/include/flang/Lower/PFTBuilder.h
    M flang/include/flang/Optimizer/Dialect/FIRAttr.td
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/test/Lower/HLFIR/assumed-rank-internal-proc.f90
    M flang/test/Lower/HLFIR/cray-pointers.f90
    M flang/test/Lower/HLFIR/internal-procedures.f90
    M flang/test/Lower/OpenMP/threadprivate-host-association-2.f90
    M flang/test/Lower/OpenMP/threadprivate-host-association.f90

  Log Message:
  -----------
  [flang] add internal_assoc flag to mark variable captured in internal procedure (#117161)

This patch adds a flag to mark hlfir.declare of host variables that are
captured in some internal procedure.

It enables implementing a simple fir.call handling in
fir::AliasAnalysis::getModRef leveraging Fortran language specifications
and without a data flow analysis.

This will allow implementing an optimization for "array =
array_function()" where array storage is passed directly into the hidden
result argument to "array_function" when it can be proven that
arraY_function does not reference "array".

Captured host variables are very tricky because they may be accessed
indirectly in any calls if the internal procedure address was captured
via some global procedure pointer. Without flagging them, there is no
way around doing a complex inter procedural data flow analysis:
- checking that the call is not made to an internal procedure is not
enough because of the possibility of indirect calls made to internal
procedures inside the callee.
- checking that the current func.func has no internal procedure is not
enough because this would be invalid with inlining when an procedure
with internal procedures is inlined inside a procedure without internal
procedure.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list