[clang] [llvm] [mlir] [OpenMP] Preserve host capture lifetimes in frontend lowering (PR #218453)

Tomas Matheson via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 09:54:07 PDT 2026


tommat01 wrote:

Thanks everyone for the comments. The general feeling seemed to be that the frontend would be a better fit for this. Therefore reimplemented, in a slightly different way: the frontend now adds `nofreeobj` to capture slots around parallel regions. This is safe to do because the caller will wait until the region completes, but we can't assume `noalias` since the address of the slots may still escape.
This results in  a lot of repetitive test changes due to the new attributes. The interesting files are:
- clang/lib/CodeGen/CGOpenMPRuntime.cpp (main implementation)
- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (adds `noalias` to the bundle struct containing the captures)
- clang/test/OpenMP/callback_capture_lifetime.cpp
- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
- mlir/test/Target/LLVMIR/openmp-capture-lifetime.mlir


https://github.com/llvm/llvm-project/pull/218453


More information about the cfe-commits mailing list