[clang] [Clang][OpenMP] Keep untied task locals in the task on the device (PR #248062)

Julian Brown via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 03:26:16 PST 2026


================
@@ -2211,6 +2211,14 @@ void CGOpenMPRuntimeGPU::emitFunctionProlog(CodeGenFunction &CGF,
 
 Address CGOpenMPRuntimeGPU::getAddressOfLocalVariable(CodeGenFunction &CGF,
                                                         const VarDecl *VD) {
+  // A local variable of an untied task is kept in the task, so that it
+  // survives the task returning at a task scheduling point and being resumed.
+  if (VD && !VD->hasAttr<OMPAllocateDeclAttr>()) {
+    Address UntiedAddr = CGOpenMPRuntime::getAddressOfLocalVariable(CGF, VD);
+    if (UntiedAddr.isValid())
+      return UntiedAddr;
+  }
+
   if (VD && VD->hasAttr<OMPAllocateDeclAttr>()) {
----------------
jtb20 wrote:

This too...

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


More information about the cfe-commits mailing list