diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp index ded4c7ab27274..b82ad20d8e194 100644 --- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp +++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp @@ -3513,7 +3513,8 @@ checkDeclareOperands(Op &op, const mlir::ValueRange &operands, "at least one operand must appear on the declare operation"); for (mlir::Value operand : operands) { - if (!mlir::isa(operand) || + !mlir::isa( operand.getDefiningOp())) diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir index 68afd9fccba79..24ce9784393b0 100644 --- a/mlir/test/Dialect/OpenACC/invalid.mlir +++ b/mlir/test/Dialect/OpenACC/invalid.mlir @@ -831,3 +831,12 @@ func.func @acc_loop_container() { %value = memref.alloc() : memref // expected-error @below {{invalid data clause modifiers: readonly}} %0 = acc.create varPtr(%value : memref) -> memref {modifiers = #acc} + +// ----- + +func.func @verify_declare_enter(%arg0 : memref) { +// expected-error @below {{expect valid declare data entry operation or acc.getdeviceptr as defining op}} + %0 = acc.declare_enter dataOperands(%arg0 : memref) + acc.declare_exit token(%0) dataOperands(%arg0 : memref) + return +}