[Mlir-commits] [mlir] [mlir][openacc] Support already existing global in GPU module (PR #210806)

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Tue Jul 21 10:53:31 PDT 2026


================
@@ -99,20 +98,22 @@ class ACCDeclareGPUModuleInsertion
       StringAttr name = symOp.getNameAttr();
 
       if (Operation *existing = gpuSymTable.lookup(name.getValue())) {
-        // Reuse only when the existing GPU symbol is structurally equivalent to
-        // the global we would insert. Otherwise treat as a conflict (different
-        // op type or different definition).
-        if (existing->getName() != globalOp.getName() ||
-            !OperationEquivalence::isEquivalentTo(
----------------
clementval wrote:

The difference is that one global has the acc declare attribute already. 

```
fir.global linkonce_odr @g1 constant : !fir.char<1> {
  %0 = fir.string_lit "p"(1) : !fir.char<1>
  fir.has_value %0 : !fir.char<1>
}
fir.global linkonce_odr @g1 {acc.declare = #acc.declare<dataClause = acc_copyin>} constant : !fir.char<1> {
  %0 = fir.string_lit "p"(1) : !fir.char<1>
  fir.has_value %0 : !fir.char<1>
}
```

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


More information about the Mlir-commits mailing list