diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp index 56f3228d3a652..66584dc708b8c 100644 --- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp +++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp @@ -2910,32 +2910,6 @@ checkDeclareOperands(Op &op, const mlir::ValueRange &operands, assert(dataClauseOptional.has_value() && "declare operands can only be data entry operations which must have " "dataClause"); - - // If varPtr has no defining op - there is nothing to check further. - if (!var.getDefiningOp()) - continue; - - // Check that the varPtr has a declare attribute. - auto declareAttribute{ - var.getDefiningOp()->getAttr(mlir::acc::getDeclareAttrName())}; - if (!declareAttribute) - return op.emitError( - "expect declare attribute on variable in declare operation"); - - auto declAttr = mlir::cast(declareAttribute); - if (declAttr.getDataClause().getValue() != dataClauseOptional.value()) - return op.emitError( - "expect matching declare attribute on variable in declare operation"); - - // If the variable is marked with implicit attribute, the matching declare - // data action must also be marked implicit. The reverse is not checked - // since implicit data action may be inserted to do actions like updating - // device copy, in which case the variable is not necessarily implicitly - // declare'd. - if (declAttr.getImplicit() && - declAttr.getImplicit() != acc::getImplicitFlag(operand.getDefiningOp())) - return op.emitError( - "implicitness must match between declare op and flag on variable"); } return success();