[flang-commits] [flang] [flang][OpenMP] Extend `do concurrent` mapping to device (PR #155987)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Wed Sep 10 00:46:05 PDT 2025


================
@@ -244,6 +325,51 @@ class DoConcurrentConversion
   }
 
 private:
+  struct TargetDeclareShapeCreationInfo {
+    // Note: We use `std::vector` (rather than `llvm::SmallVector` as usual) to
+    // interface more easily `ShapeShiftOp::getOrigins()` which returns
+    // `std::vector`.
+    std::vector<mlir::Value> startIndices{};
+    std::vector<mlir::Value> extents{};
+
+    TargetDeclareShapeCreationInfo(mlir::Value liveIn) {
+      mlir::Value shape = nullptr;
+      mlir::Operation *liveInDefiningOp = liveIn.getDefiningOp();
+      auto declareOp =
+          mlir::dyn_cast_if_present<hlfir::DeclareOp>(liveInDefiningOp);
+
+      if (declareOp != nullptr)
+        shape = declareOp.getShape();
+
+      if (shape == nullptr)
----------------
ergawy wrote:

Done.

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


More information about the flang-commits mailing list