[all-commits] [llvm/llvm-project] 75e564: [flang][OpenMP] share global variable initializati...

Tom Eccles via All-commits all-commits at lists.llvm.org
Wed May 7 02:18:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75e5643abf6b59db8dfae6b524e9c3c2ec0ffc29
      https://github.com/llvm/llvm-project/commit/75e5643abf6b59db8dfae6b524e9c3c2ec0ffc29
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2025-05-07 (Wed, 07 May 2025)

  Changed paths:
    M flang/docs/OpenMPSupport.md
    M flang/include/flang/Lower/ConvertVariable.h
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/omp-declare-target-program-var.f90
    M flang/test/Lower/OpenMP/threadprivate-host-association-2.f90
    M flang/test/Lower/OpenMP/threadprivate-host-association-3.f90
    A flang/test/Lower/OpenMP/threadprivate-lenparams.f90
    M flang/test/Lower/OpenMP/threadprivate-non-global.f90

  Log Message:
  -----------
  [flang][OpenMP] share global variable initialization code (#138672)

Fixes #108136

In #108136 (the new testcase), flang was missing the length parameter
required for the variable length string when boxing the global variable.
The code that is initializing global variables for OpenMP did not
support types with length parameters.

Instead of duplicating this initialization logic in OpenMP, I decided to
use the exact same initialization as is used in the base language
because this will already be well tested and will be updated for any new
types. The difference for OpenMP is that the global variables will be
zero initialized instead of left undefined.

Previously `Fortran::lower::createGlobalInitialization` was used to
share a smaller amount of the logic with the base language lowering. I
think this bug has demonstrated that helper was too low level to be
helpful, and it was only used in OpenMP so I have made it static inside
of ConvertVariable.cpp.



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