@@ -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