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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 3 08:31:33 PDT 2026


================
@@ -1109,6 +1109,21 @@ class OpenMPIRBuilder {
       std::function<GlobalValue::LinkageTypes()> VariableLinkage,
       Type *LlvmPtrTy, Constant *Addr);
 
+  /// Register a module-scope replacement of a declare target global variable.
+  /// During lowering new globals are generated for certain combinations of
+  /// declare target input, and these new globals require substitution with
+  /// the originals. This replacement occurs during finalization where uses
+  /// of \p Original are rewritten to reference \p Replacement. This is
+  /// predominantly required for Flang where the lowering pattern to LLVM
+  /// prevents immediate use rewrites.
----------------
agozillon wrote:

True, I always associate the lowering with Flang as it's the only one present until recently, but it'll impact CIR as well!



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


More information about the Mlir-commits mailing list