1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Mark unordered memset/memmove/memcpy as nosync

Mostly a means to remove a bit of code from attributor in advance of implementing a FuncAttr inference for nosync.
This commit is contained in:
Philip Reames 2021-04-01 10:37:22 -07:00
parent 7aed91bb62
commit 1695a86b7f
3 changed files with 10 additions and 14 deletions

View File

@ -1503,22 +1503,24 @@ def int_xray_typedevent : Intrinsic<[], [llvm_i16_ty, llvm_ptr_ty, llvm_i32_ty],
def int_memcpy_element_unordered_atomic
: Intrinsic<[],
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty, llvm_i32_ty],
[IntrArgMemOnly, IntrWillReturn, NoCapture<ArgIndex<0>>,
NoCapture<ArgIndex<1>>, WriteOnly<ArgIndex<0>>,
ReadOnly<ArgIndex<1>>, ImmArg<ArgIndex<3>>]>;
[IntrArgMemOnly, IntrWillReturn, IntrNoSync,
NoCapture<ArgIndex<0>>, NoCapture<ArgIndex<1>>,
WriteOnly<ArgIndex<0>>, ReadOnly<ArgIndex<1>>,
ImmArg<ArgIndex<3>>]>;
// @llvm.memmove.element.unordered.atomic.*(dest, src, length, elementsize)
def int_memmove_element_unordered_atomic
: Intrinsic<[],
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty, llvm_i32_ty],
[IntrArgMemOnly, IntrWillReturn, NoCapture<ArgIndex<0>>,
NoCapture<ArgIndex<1>>, WriteOnly<ArgIndex<0>>,
ReadOnly<ArgIndex<1>>, ImmArg<ArgIndex<3>>]>;
[IntrArgMemOnly, IntrWillReturn, IntrNoSync,
NoCapture<ArgIndex<0>>, NoCapture<ArgIndex<1>>,
WriteOnly<ArgIndex<0>>, ReadOnly<ArgIndex<1>>,
ImmArg<ArgIndex<3>>]>;
// @llvm.memset.element.unordered.atomic.*(dest, value, length, elementsize)
def int_memset_element_unordered_atomic
: Intrinsic<[], [llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty, llvm_i32_ty],
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn,
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn, IntrNoSync,
NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>,
ImmArg<ArgIndex<3>>]>;

View File

@ -1347,12 +1347,6 @@ bool AANoSyncImpl::isNonRelaxedAtomic(Instruction *I) {
bool AANoSyncImpl::isNoSyncIntrinsic(Instruction *I) {
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
/// Element wise atomic memory intrinsics are can only be unordered,
/// therefore nosync.
case Intrinsic::memset_element_unordered_atomic:
case Intrinsic::memmove_element_unordered_atomic:
case Intrinsic::memcpy_element_unordered_atomic:
return true;
case Intrinsic::memset:
case Intrinsic::memmove:
case Intrinsic::memcpy:

View File

@ -389,7 +389,7 @@ entry:
; CHECK: attributes #0 = { argmemonly nofree nosync nounwind willreturn writeonly }
; CHECK-NEXT: attributes #1 = { argmemonly nofree nosync nounwind willreturn }
; CHECK-NEXT: attributes #2 = { argmemonly nounwind willreturn }
; CHECK-NEXT: attributes #2 = { argmemonly nosync nounwind willreturn }
; CHECK-NEXT: attributes #3 = { noinline nounwind readonly }
; CHECK-NEXT: attributes #4 = { noinline nounwind writeonly }
; CHECK-NEXT: attributes #5 = { nounwind ssp }