[Mlir-commits] [llvm] [mlir] [Flang][OpenMP][OpenMPIRBuilder] Implement module scope declare target use rewrite mechanism (PR #212920)

Sergio Afonso llvmlistbot at llvm.org
Mon Aug 3 07:06:14 PDT 2026


================
@@ -0,0 +1,48 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+// This test verifies the module-scope declare target global use rewrite
+// mechanism for a `declare target link` variable when compiling for device.
+//
+// The declare target global is used both directly inside of a target region
+// and indirectly inside of a declare target function that is invoked from
+// within that target region. Because the rewrite is now applied at module
+// scope during OpenMPIRBuilder finalization (rather than only within the
+// outlined target region), the use of the original global inside of the
+// declare target function should also be rewritten to load from the generated
+// reference pointer.
----------------
skatrak wrote:

Please avoid making references to previous implementations. They no longer make sense after the patch is applied.

```suggestion
// within that target region. Both uses of the original global should be rewritten to load from the generated reference pointer.
```

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


More information about the Mlir-commits mailing list