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

Kiran Chandramohan llvmlistbot at llvm.org
Thu Aug 1 02:27:36 PDT 2024


================
@@ -549,9 +549,16 @@ 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);
+
+      firOpBuilder.create<mlir::omp::YieldOp>(hsb.getAddr().getLoc(),
+                                              yieldedValue);
----------------
kiranchandramohan wrote:

Nit: Can you add a comment on where the convert is usually required?

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


More information about the Mlir-commits mailing list