[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

Razvan Lupusoru via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 09:14:08 PDT 2025


================
@@ -184,37 +189,94 @@ class OpenACCClauseCIREmitter final
     mlir::Location beginLoc;
     mlir::Value varValue;
     llvm::StringRef name;
+    llvm::SmallVector<mlir::Value> bounds;
   };
 
+  mlir::Value createBound(mlir::Location boundLoc, mlir::Value lowerBound,
+                          mlir::Value upperBound, mlir::Value extent) {
+    // Arrays always have a start-idx of 0.
+    mlir::Value startIdx = createConstantInt(boundLoc, 64, 0);
+    // TODO: OpenACC: It isn't clear that stride would ever be anything other
+    // than '1'?  We emit the type of the reference 'correctly' as far as I
----------------
razvanlupusoru wrote:

I think it is OK to remove the TODO here. I agree both with the choice to have stride as '1' and not specified in bytes.

The acc dialect permits non-1 stride because not all languages have contiguous arrays. And in particular, I imagine if CIR allowed native representation of non-contiguous array views - taking advantage of this functionality would be necessary.

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


More information about the cfe-commits mailing list