Add a constraint to ensure that the operand and result of the
threadprivate operation are the same.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/
D128609
// [5.1] 2.21.2 threadprivate Directive
//===----------------------------------------------------------------------===//
-def ThreadprivateOp : OpenMP_Op<"threadprivate"> {
+def ThreadprivateOp : OpenMP_Op<"threadprivate",
+ [AllTypesMatch<["sym_addr", "tls_addr"]>]> {
let summary = "threadprivate directive";
let description = [{
The threadprivate directive specifies that variables are replicated, with
}
return
}
+
+// -----
+
+func.func @omp_threadprivate() {
+ %1 = llvm.mlir.addressof @_QFsubEx : !llvm.ptr<i32>
+ // expected-error @below {{op failed to verify that all of {sym_addr, tls_addr} have same type}}
+ %2 = omp.threadprivate %1 : !llvm.ptr<i32> -> memref<i32>
+ return
+}
+
+llvm.mlir.global internal @_QFsubEx() : i32