[llvm] 6b05d75 - Mark unordered memset/memmove/memcpy as nosync
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 1 10:39:03 PDT 2021
Author: Philip Reames
Date: 2021-04-01T10:38:54-07:00
New Revision: 6b05d753e0769d841a5e95ccf86938143a922dc8
URL: https://github.com/llvm/llvm-project/commit/6b05d753e0769d841a5e95ccf86938143a922dc8
DIFF: https://github.com/llvm/llvm-project/commit/6b05d753e0769d841a5e95ccf86938143a922dc8.diff
LOG: 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.
Added:
Modified:
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Analysis/BasicAA/cs-cs.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index d2b990691b1b7..62b5c0fc2a524 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -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>>]>;
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index fa32a22059ac3..71d0146432cc1 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -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:
diff --git a/llvm/test/Analysis/BasicAA/cs-cs.ll b/llvm/test/Analysis/BasicAA/cs-cs.ll
index 4eb348a02bbfb..83c663933c6ca 100644
--- a/llvm/test/Analysis/BasicAA/cs-cs.ll
+++ b/llvm/test/Analysis/BasicAA/cs-cs.ll
@@ -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 }
More information about the llvm-commits
mailing list