This patch makes sure that the address dereferences to value in
omp.atomic.write operation.
Reviewed By: kiranchandramohan, peixin
Differential Revision: https://reviews.llvm.org/D126272
"memory-order must not be acq_rel or acquire for atomic writes");
}
}
+ if (address().getType().cast<PointerLikeType>().getElementType() !=
+ value().getType())
+ return emitError("address must dereference to value type");
return verifySynchronizationHint(*this, hint_val());
}
// -----
+func.func @omp_atomic_write(%addr : memref<memref<i32>>, %val : i32) {
+ // expected-error @below {{address must dereference to value type}}
+ omp.atomic.write %addr = %val : memref<memref<i32>>, i32
+ return
+}
+
+// -----
+
func.func @omp_atomic_update1(%x: memref<i32>, %expr: f32) {
// expected-error @below {{the type of the operand must be a pointer type whose element type is the same as that of the region argument}}
omp.atomic.update %x : memref<i32> {