Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions clang/lib/CIR/CodeGen/CIRGenDeclOpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ using namespace clang::CIRGen;

namespace {
struct OpenACCDeclareCleanup final : EHScopeStack::Cleanup {
SourceRange declareRange;
mlir::acc::DeclareEnterOp enterOp;

OpenACCDeclareCleanup(SourceRange declareRange,
mlir::acc::DeclareEnterOp enterOp)
: declareRange(declareRange), enterOp(enterOp) {}
OpenACCDeclareCleanup(mlir::acc::DeclareEnterOp enterOp) : enterOp(enterOp) {}

template <typename OutTy, typename InTy>
void createOutOp(CIRGenFunction &cgf, InTy inOp) {
Expand Down Expand Up @@ -78,16 +75,19 @@ struct OpenACCDeclareCleanup final : EHScopeStack::Cleanup {
createOutOp<mlir::acc::DeleteOp>(cgf, create);
break;
}
} else if (auto create = val.getDefiningOp<mlir::acc::PresentOp>()) {
createOutOp<mlir::acc::DeleteOp>(cgf, create);
} else if (auto present = val.getDefiningOp<mlir::acc::PresentOp>()) {
createOutOp<mlir::acc::DeleteOp>(cgf, present);
} else if (auto dev_res =
val.getDefiningOp<mlir::acc::DeclareDeviceResidentOp>()) {
createOutOp<mlir::acc::DeleteOp>(cgf, dev_res);
} else if (val.getDefiningOp<mlir::acc::DeclareLinkOp>()) {
// Link has no exit clauses, and shouldn't be copied.
continue;
} else if (val.getDefiningOp<mlir::acc::DevicePtrOp>()) {
// DevicePtr has no exit clauses, and shouldn't be copied.
continue;
} else {
cgf.cgm.errorNYI(declareRange, "OpenACC local declare clause cleanup");
llvm_unreachable("OpenACC local declare clause unexpected defining op");
continue;
}
exitOp.getDataClauseOperandsMutable().append(val);
Expand All @@ -106,7 +106,7 @@ void CIRGenFunction::emitOpenACCDeclare(const OpenACCDeclareDecl &d) {
d.clauses());

ehStack.pushCleanup<OpenACCDeclareCleanup>(CleanupKind::NormalCleanup,
d.getSourceRange(), enterOp);
enterOp);
}

void CIRGenFunction::emitOpenACCRoutine(const OpenACCRoutineDecl &d) {
Expand Down
12 changes: 12 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,18 @@ class OpenACCClauseCIREmitter final
llvm_unreachable("Unknown construct kind in VisitReductionClause");
}
}

void VisitDeviceResidentClause(const OpenACCDeviceResidentClause &clause) {
if constexpr (isOneOfTypes<OpTy, mlir::acc::DeclareEnterOp>) {
for (const Expr *var : clause.getVarList())
addDataOperand<mlir::acc::DeclareDeviceResidentOp>(
var, mlir::acc::DataClause::acc_declare_device_resident, {},
/*structured=*/true,
/*implicit=*/false);
} else {
llvm_unreachable("Unknown construct kind in VisitDeviceResidentClause");
}
}
};

template <typename OpTy>
Expand Down
Loading
Loading