[mlir][openacc] Add check for the private list in acc.serial
authorValentin Clement <clementval@gmail.com>
Wed, 24 May 2023 17:39:00 +0000 (10:39 -0700)
committerValentin Clement <clementval@gmail.com>
Wed, 24 May 2023 17:39:34 +0000 (10:39 -0700)
Add the missing check on private list information. The
check is the same than the one done for acc.parallel.

Depends on D151146

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D151149

mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
mlir/test/Dialect/OpenACC/invalid.mlir

index 5e5a00e..73f3409 100644 (file)
@@ -580,7 +580,10 @@ Value SerialOp::getDataOperand(unsigned i) {
 }
 
 LogicalResult acc::SerialOp::verify() {
-
+  if (failed(checkSymOperandList<mlir::acc::PrivateRecipeOp>(
+          *this, getPrivatizations(), getGangPrivateOperands(), "private",
+          "privatizations")))
+    return failure();
   return checkDataOperands<acc::SerialOp>(*this, getDataClauseOperands());
 }
 
index 899499b..3c1ac1d 100644 (file)
@@ -462,3 +462,12 @@ acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init {
   %2 = arith.constant 0 : i32
   acc.yield %2 : i32
 }
+
+// -----
+
+func.func @fct1(%0 : !llvm.ptr<i32>) -> () {
+  // expected-error@+1 {{expected symbol reference @privatization_i32 to point to a private declaration}}
+  acc.serial private(@privatization_i32 -> %0 : !llvm.ptr<i32>) {
+  }
+  return
+}