[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 13:30:40 PDT 2025
================
@@ -250,14 +420,26 @@ class OpenACCClauseCIREmitter final
}
void VisitAsyncClause(const OpenACCAsyncClause &clause) {
+ hasAsyncClause = true;
if constexpr (isOneOfTypes<OpTy, mlir::acc::ParallelOp, mlir::acc::SerialOp,
mlir::acc::KernelsOp, mlir::acc::DataOp>) {
if (!clause.hasIntExpr())
operation.addAsyncOnly(builder.getContext(), lastDeviceTypeValues);
- else
- operation.addAsyncOperand(builder.getContext(),
- createIntExpr(clause.getIntExpr()),
+ else {
+
+ mlir::Value intExpr;
+ {
+ // Async int exprs can be referenced by the data operands, which means
+ // that the int-exprs have to appear before them. IF there is a data
+ // operand already, set the insertion point to 'before' it.
+ mlir::OpBuilder::InsertionGuard guardCase(builder);
+ if (!dataOperands.empty())
+ builder.setInsertionPoint(dataOperands.front());
----------------
erichkeane wrote:
I considered putting these at the beginning of the 'block', but that ends up moving them very far away, which made for less readable IR. Instead, I just make sure they are before the first data operation.
https://github.com/llvm/llvm-project/pull/140304
More information about the cfe-commits
mailing list