[flang-commits] [flang] [flang][openacc] Keep constant bounds in reduction recipe when it is all constants (PR #67827)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon Oct 2 13:57:27 PDT 2023


================
@@ -478,6 +478,34 @@ mlir::acc::FirstprivateRecipeOp Fortran::lower::createOrGetFirstprivateRecipe(
   return recipe;
 }
 
+/// Get a string representation of the bounds.
+std::string getBoundsString(llvm::SmallVector<mlir::Value> &bounds) {
+  std::stringstream boundStr;
+  bool addSeparator = false;
+  if (!bounds.empty())
+    boundStr << "_section_";
+  for (auto bound : bounds) {
+    auto boundsOp =
+        mlir::dyn_cast<mlir::acc::DataBoundsOp>(bound.getDefiningOp());
----------------
vzakhari wrote:

Some static code verifiers would probably complain that `boundsOp` might be null after the cast, so dereferencing them is not safe.  Can you please use `mlir::cast`?

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


More information about the flang-commits mailing list