Skip to content

Commit fb1b8c8

Browse files
author
Razvan Lupusoru
committed
Update invalid test to include new messages
1 parent ad2a302 commit fb1b8c8

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ static LogicalResult checkPrivateOperands(mlir::Operation *accConstructOp,
10681068
for (mlir::Value operand : operands) {
10691069
if (!mlir::isa<OpT>(operand.getDefiningOp()))
10701070
return accConstructOp->emitOpError()
1071-
<< "expect " << operandName << " as defining op";
1071+
<< "expected " << operandName << " as defining op";
10721072
if (!set.insert(operand).second)
10731073
return accConstructOp->emitOpError()
10741074
<< operandName << " operand appears more than once";

mlir/test/Dialect/OpenACC/invalid.mlir

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,3 +823,48 @@ func.func @acc_loop_container() {
823823
// expected-error @below {{invalid data clause modifiers: readonly}}
824824
%0 = acc.create varPtr(%value : memref<f32>) -> memref<f32> {modifiers = #acc<data_clause_modifier readonly,zero,capture,always>}
825825

826+
// -----
827+
828+
func.func @fct1(%0 : !llvm.ptr) -> () {
829+
// expected-error @below {{expected symbol reference @privatization_i32 to point to a private declaration}}
830+
%priv = acc.private varPtr(%0 : !llvm.ptr) varType(i32) recipe(@privatization_i32) -> !llvm.ptr
831+
return
832+
}
833+
834+
// -----
835+
836+
acc.private.recipe @privatization_i32 : !llvm.ptr init {
837+
^bb0(%arg0: !llvm.ptr):
838+
%c1 = arith.constant 1 : i32
839+
%c0 = arith.constant 0 : i32
840+
%0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr
841+
llvm.store %c0, %0 : i32, !llvm.ptr
842+
acc.yield %0 : !llvm.ptr
843+
}
844+
845+
func.func @fct1(%0 : !llvm.ptr) -> () {
846+
%priv = acc.private varPtr(%0 : !llvm.ptr) varType(i32) recipe(@privatization_i32) -> !llvm.ptr
847+
// expected-error @below {{expected firstprivate as defining op}}
848+
acc.serial firstprivate(%priv : !llvm.ptr) {
849+
}
850+
return
851+
}
852+
853+
// -----
854+
855+
acc.private.recipe @privatization_i32 : !llvm.ptr init {
856+
^bb0(%arg0: !llvm.ptr):
857+
%c1 = arith.constant 1 : i32
858+
%c0 = arith.constant 0 : i32
859+
%0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr
860+
llvm.store %c0, %0 : i32, !llvm.ptr
861+
acc.yield %0 : !llvm.ptr
862+
}
863+
864+
func.func @fct1(%0 : !llvm.ptr) -> () {
865+
%priv = acc.private varPtr(%0 : !llvm.ptr) varType(i32) recipe(@privatization_i32) -> !llvm.ptr
866+
// expected-error @below {{op private operand appears more than once}}
867+
acc.serial private(%priv, %priv : !llvm.ptr, !llvm.ptr) {
868+
}
869+
return
870+
}

0 commit comments

Comments
 (0)