[clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

Razvan Lupusoru via cfe-commits cfe-commits at lists.llvm.org
Mon May 5 15:49:43 PDT 2025


================
@@ -336,6 +348,52 @@ class OpenACCClauseCIREmitter final
       return clauseNotImplemented(clause);
     }
   }
+
+  void VisitCollapseClause(const OpenACCCollapseClause &clause) {
+    if constexpr (isOneOfTypes<OpTy, mlir::acc::LoopOp>) {
+      llvm::APInt value =
+          clause.getIntExpr()->EvaluateKnownConstInt(cgf.cgm.getASTContext());
+
+      if (value.getBitWidth() != 64)
+        value = value.sext(64);
----------------
razvanlupusoru wrote:

The OpenACC spec does not provide exact clarification on what "integer expression" is - except in one spot in the spec:
```
5348 Async-argument – an async-argument is a nonnegative scalar integer expression (int for C or C++, integer for Fortran)
```
It seems the intent is that they are 32-bit integers.

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


More information about the cfe-commits mailing list