[all-commits] [llvm/llvm-project] 988778: [CIR] Force emission of static local enclosing fun...

Andy Kaylor via All-commits all-commits at lists.llvm.org
Thu Jun 11 09:31:01 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 988778d2216deaca5405f23020374f8ca6c131ee
      https://github.com/llvm/llvm-project/commit/988778d2216deaca5405f23020374f8ca6c131ee
  Author: Andy Kaylor <akaylor at nvidia.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenDecl.cpp
    A clang/test/CIR/CodeGen/static-local-nested-reference.cpp

  Log Message:
  -----------
  [CIR] Force emission of static local enclosing functions (#201941)

When getOrCreateStaticVarDecl is called, we need to call
`getAddressOfGlobal` to trigger the emission of the enclosing function.
In most cases this has already happened, but there are cases where the
enclosing function would not otherwise have been emitted. See
https://bugs.llvm.org/show_bug.cgi?id=18020 for details.

It appears that this was mistakenly seen as OpenMP-specific behavior
because of an OpenMP RAII guard that surrounds it in classic codegen,
but that actually is there to skip the behavior when generating OpenMP
device code.

We also needed to insert the static local decl into CIRGenModule's map
by calling `setStaticLocalDeclAddress`. To avoid a duplicate emission.

Assisted-by: Cursor / claude-opus-4.8



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