[flang-commits] [flang] [mlir] [flang][OpenMP] Delayed privatization for variables with `equivalence` association (PR #100531)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Wed Jul 31 04:29:57 PDT 2024


================
@@ -549,9 +549,17 @@ void DataSharingProcessor::doPrivatize(const semantics::Symbol *sym,
       symTable->addSymbol(*sym, localExV);
       symTable->pushScope();
       cloneSymbol(sym);
-      firOpBuilder.create<mlir::omp::YieldOp>(
-          hsb.getAddr().getLoc(),
-          symTable->shallowLookupSymbol(*sym).getAddr());
+      mlir::Value cloneAddr = symTable->shallowLookupSymbol(*sym).getAddr();
+      mlir::Type cloneType = cloneAddr.getType();
+
+      mlir::Value yieldedValue =
+          (symType == cloneType) ? cloneAddr
+                                 : firOpBuilder.createConvert(
+                                       cloneAddr.getLoc(), symType, cloneAddr);
+
+      auto yieldOp = firOpBuilder.create<mlir::omp::YieldOp>(
+          hsb.getAddr().getLoc(), yieldedValue);
+      yieldOp.getOperand(0).getType();
----------------
skatrak wrote:

Nit: This looks like some leftover code.
```suggestion
```

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


More information about the flang-commits mailing list