[llvm] 4223c9b - [Attributor] Always deduce nosync from readonly + non-convergent
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 17:47:46 PDT 2023
Author: Johannes Doerfert
Date: 2023-07-25T17:47:33-07:00
New Revision: 4223c9b35428dd851a5c98dce61afb626f49b26d
URL: https://github.com/llvm/llvm-project/commit/4223c9b35428dd851a5c98dce61afb626f49b26d
DIFF: https://github.com/llvm/llvm-project/commit/4223c9b35428dd851a5c98dce61afb626f49b26d.diff
LOG: [Attributor] Always deduce nosync from readonly + non-convergent
This adds the deduction also if the function is not IPO amendable.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/liveness_chains.ll
llvm/test/Transforms/Attributor/memory_locations.ll
llvm/test/Transforms/Attributor/memory_locations_gpu.ll
llvm/test/Transforms/Attributor/nocapture-1.ll
llvm/test/Transforms/Attributor/nocapture-2.ll
llvm/test/Transforms/Attributor/nofree.ll
llvm/test/Transforms/Attributor/nonnull.ll
llvm/test/Transforms/Attributor/norecurse.ll
llvm/test/Transforms/Attributor/readattrs.ll
llvm/test/Transforms/Attributor/value-simplify-dbg.ll
llvm/test/Transforms/Attributor/value-simplify.ll
llvm/test/Transforms/Attributor/willreturn.ll
llvm/test/Transforms/OpenMP/parallel_deletion.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 1da00acdf03414..8a5a0955d1326d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -3426,6 +3426,36 @@ struct AANoSync
AANoSync> {
AANoSync(const IRPosition &IRP, Attributor &A) : IRAttribute(IRP) {}
+ static bool isImpliedByIR(Attributor &A, const IRPosition &IRP,
+ Attribute::AttrKind ImpliedAttributeKind,
+ bool IgnoreSubsumingPositions = false) {
+ // Note: This is also run for non-IPO amendable functions.
+ assert(ImpliedAttributeKind == Attribute::NoSync);
+ if (A.hasAttr(IRP, {Attribute::NoSync}, IgnoreSubsumingPositions,
+ Attribute::NoSync))
+ return true;
+
+ // Check for readonly + non-convergent.
+ // TODO: We should be able to use hasAttr for Attributes, not only
+ // AttrKinds.
+ Function *F = IRP.getAssociatedFunction();
+ if (!F || F->isConvergent())
+ return false;
+
+ SmallVector<Attribute, 2> Attrs;
+ A.getAttrs(IRP, {Attribute::Memory}, Attrs, IgnoreSubsumingPositions);
+
+ MemoryEffects ME = MemoryEffects::unknown();
+ for (const Attribute &Attr : Attrs)
+ ME &= Attr.getMemoryEffects();
+
+ if (!ME.onlyReadsMemory())
+ return false;
+
+ A.manifestAttrs(IRP, Attribute::get(F->getContext(), Attribute::NoSync));
+ return true;
+ }
+
/// See AbstractAttribute::isValidIRPositionForInit
static bool isValidIRPositionForInit(Attributor &A, const IRPosition &IRP) {
if (!IRP.isFunctionScope() &&
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index b1c46c106dec21..4cb2ad68e0b3ce 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -3297,6 +3297,9 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
// Every function might be "will-return".
checkAndQueryIRAttr<Attribute::WillReturn, AAWillReturn>(FPos, FnAttrs);
+ // Every function might be marked "nosync"
+ checkAndQueryIRAttr<Attribute::NoSync, AANoSync>(FPos, FnAttrs);
+
// Everything that is visible from the outside (=function, argument, return
// positions), cannot be changed if the function is not IPO amendable. We can
// however analyse the code inside.
@@ -3305,9 +3308,6 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
// Every function can be nounwind.
checkAndQueryIRAttr<Attribute::NoUnwind, AANoUnwind>(FPos, FnAttrs);
- // Every function might be marked "nosync"
- checkAndQueryIRAttr<Attribute::NoSync, AANoSync>(FPos, FnAttrs);
-
// Every function might be "no-return".
checkAndQueryIRAttr<Attribute::NoReturn, AANoReturn>(FPos, FnAttrs);
diff --git a/llvm/test/Transforms/Attributor/liveness_chains.ll b/llvm/test/Transforms/Attributor/liveness_chains.ll
index 7ab1f2410633fe..acdfa747423aac 100644
--- a/llvm/test/Transforms/Attributor/liveness_chains.ll
+++ b/llvm/test/Transforms/Attributor/liveness_chains.ll
@@ -27,10 +27,10 @@ define i32 @chain_dead(i32 %arg) {
}
define i32 @chain_alive(i32 %arg) {
-; CHECK: Function Attrs: nounwind memory(read)
+; CHECK: Function Attrs: nosync nounwind memory(read)
; CHECK-LABEL: define {{[^@]+}}@chain_alive
-; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT: [[INIT:%.*]] = call i32 @source() #[[ATTR0]]
+; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
+; CHECK-NEXT: [[INIT:%.*]] = call i32 @source() #[[ATTR2]]
; CHECK-NEXT: [[V0:%.*]] = add i32 [[ARG]], [[INIT]]
; CHECK-NEXT: [[V1:%.*]] = add i32 [[INIT]], [[V0]]
; CHECK-NEXT: [[V2:%.*]] = add i32 [[V0]], [[V1]]
@@ -57,8 +57,9 @@ define i32 @chain_alive(i32 %arg) {
ret i32 %v9
}
;.
-; CHECK: attributes #[[ATTR0]] = { nounwind memory(read) }
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nounwind memory(read) }
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
+; CHECK: attributes #[[ATTR2]] = { nosync nounwind memory(read) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CGSCC: {{.*}}
diff --git a/llvm/test/Transforms/Attributor/memory_locations.ll b/llvm/test/Transforms/Attributor/memory_locations.ll
index 0d60992933212c..ec1d7d46aef4d8 100644
--- a/llvm/test/Transforms/Attributor/memory_locations.ll
+++ b/llvm/test/Transforms/Attributor/memory_locations.ll
@@ -717,7 +717,7 @@ define void @argmem_and_unknown(i1 %c, ptr %arg) memory(argmem: readwrite) {
; TUNIT-SAME: (i1 noundef [[C:%.*]], ptr writeonly [[ARG:%.*]]) #[[ATTR11:[0-9]+]] {
; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; TUNIT: t:
-; TUNIT-NEXT: [[P:%.*]] = call ptr @no_mem_unknown_ptr(ptr noalias readnone [[ARG]])
+; TUNIT-NEXT: [[P:%.*]] = call ptr @no_mem_unknown_ptr(ptr noalias readnone [[ARG]]) #[[ATTR14:[0-9]+]]
; TUNIT-NEXT: store i32 0, ptr [[P]], align 4
; TUNIT-NEXT: br label [[F]]
; TUNIT: f:
@@ -728,7 +728,7 @@ define void @argmem_and_unknown(i1 %c, ptr %arg) memory(argmem: readwrite) {
; CGSCC-SAME: (i1 noundef [[C:%.*]], ptr writeonly [[ARG:%.*]]) #[[ATTR12:[0-9]+]] {
; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CGSCC: t:
-; CGSCC-NEXT: [[P:%.*]] = call ptr @no_mem_unknown_ptr(ptr noalias readnone [[ARG]])
+; CGSCC-NEXT: [[P:%.*]] = call ptr @no_mem_unknown_ptr(ptr noalias readnone [[ARG]]) #[[ATTR16:[0-9]+]]
; CGSCC-NEXT: store i32 0, ptr [[P]], align 4
; CGSCC-NEXT: br label [[F]]
; CGSCC: f:
@@ -757,6 +757,7 @@ f:
; TUNIT: attributes #[[ATTR11]] = { nosync memory(argmem: write) }
; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind memory(write) }
+; TUNIT: attributes #[[ATTR14]] = { nosync }
;.
; CGSCC: attributes #[[ATTR0]] = { memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR1]] = { memory(argmem: readwrite, inaccessiblemem: readwrite) }
@@ -774,4 +775,5 @@ f:
; CGSCC: attributes #[[ATTR13]] = { nofree nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR14]] = { nofree nosync nounwind memory(write) }
; CGSCC: attributes #[[ATTR15]] = { nofree nounwind memory(write) }
+; CGSCC: attributes #[[ATTR16]] = { nosync }
;.
diff --git a/llvm/test/Transforms/Attributor/memory_locations_gpu.ll b/llvm/test/Transforms/Attributor/memory_locations_gpu.ll
index 90761e4f4fe3fa..70734aeedec964 100644
--- a/llvm/test/Transforms/Attributor/memory_locations_gpu.ll
+++ b/llvm/test/Transforms/Attributor/memory_locations_gpu.ll
@@ -40,7 +40,7 @@ define i32 @test_const_as_call1() {
; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@test_const_as_call1
; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(4) @ptr_to_const()
+; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(4) @ptr_to_const() #[[ATTR4:[0-9]+]]
; CHECK-NEXT: [[L1:%.*]] = load i32, ptr addrspace(4) [[P1]], align 4
; CHECK-NEXT: ret i32 [[L1]]
;
@@ -54,7 +54,7 @@ define i32 @test_const_as_call2() {
; CHECK: Function Attrs: nosync memory(none)
; CHECK-LABEL: define {{[^@]+}}@test_const_as_call2
; CHECK-SAME: () #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr()
+; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr() #[[ATTR4]]
; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[P2]], align 4
; CHECK-NEXT: ret i32 [[L2]]
;
@@ -69,7 +69,7 @@ define i32 @test_shared_as_call1() {
; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@test_shared_as_call1
; CHECK-SAME: () #[[ATTR2]] {
-; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(3) @ptr_to_shared()
+; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(3) @ptr_to_shared() #[[ATTR4]]
; CHECK-NEXT: [[L1:%.*]] = load i32, ptr addrspace(3) [[P1]], align 4
; CHECK-NEXT: ret i32 [[L1]]
;
@@ -83,7 +83,7 @@ define i32 @test_shared_as_call2() {
; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@test_shared_as_call2
; CHECK-SAME: () #[[ATTR2]] {
-; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr()
+; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr() #[[ATTR4]]
; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[P2]], align 4
; CHECK-NEXT: ret i32 [[L2]]
;
@@ -97,6 +97,7 @@ define i32 @test_shared_as_call2() {
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CHECK: attributes #[[ATTR2]] = { nosync memory(read) }
; CHECK: attributes #[[ATTR3]] = { nosync memory(none) }
+; CHECK: attributes #[[ATTR4]] = { nosync }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CGSCC: {{.*}}
diff --git a/llvm/test/Transforms/Attributor/nocapture-1.ll b/llvm/test/Transforms/Attributor/nocapture-1.ll
index 246ca83d6b6bf4..7d2f0a1351a454 100644
--- a/llvm/test/Transforms/Attributor/nocapture-1.ll
+++ b/llvm/test/Transforms/Attributor/nocapture-1.ll
@@ -35,13 +35,13 @@ define void @c3(ptr %q) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; TUNIT-LABEL: define {{[^@]+}}@c3
; TUNIT-SAME: (ptr nofree writeonly [[Q:%.*]]) #[[ATTR1]] {
-; TUNIT-NEXT: call void @c2(ptr nofree writeonly [[Q]]) #[[ATTR16:[0-9]+]]
+; TUNIT-NEXT: call void @c2(ptr nofree writeonly [[Q]]) #[[ATTR17:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write)
; CGSCC-LABEL: define {{[^@]+}}@c3
; CGSCC-SAME: (ptr nofree writeonly [[Q:%.*]]) #[[ATTR2:[0-9]+]] {
-; CGSCC-NEXT: call void @c2(ptr nofree writeonly [[Q]]) #[[ATTR19:[0-9]+]]
+; CGSCC-NEXT: call void @c2(ptr nofree writeonly [[Q]]) #[[ATTR20:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @c2(ptr %q)
@@ -130,10 +130,10 @@ define i1 @c5(ptr %q, i32 %bitno) {
declare void @throw_if_bit_set(ptr, i8) readonly
define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
-; TUNIT: Function Attrs: memory(read)
+; TUNIT: Function Attrs: nosync memory(read)
; TUNIT-LABEL: define {{[^@]+}}@c6
-; TUNIT-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
-; TUNIT-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR3]]
+; TUNIT-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; TUNIT-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR4]]
; TUNIT-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; TUNIT: ret0:
; TUNIT-NEXT: ret i1 false
@@ -142,10 +142,10 @@ define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
; TUNIT-NEXT: cleanup
; TUNIT-NEXT: ret i1 true
;
-; CGSCC: Function Attrs: memory(read)
+; CGSCC: Function Attrs: nosync memory(read)
; CGSCC-LABEL: define {{[^@]+}}@c6
-; CGSCC-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
-; CGSCC-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR4]]
+; CGSCC-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR5:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; CGSCC-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR5]]
; CGSCC-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; CGSCC: ret0:
; CGSCC-NEXT: ret i1 false
@@ -187,14 +187,14 @@ define i1 @c7(ptr %q, i32 %bitno) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@c7
; TUNIT-SAME: (ptr nofree readonly [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR2]] {
-; TUNIT-NEXT: [[PTR:%.*]] = call ptr @lookup_bit(ptr noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR17:[0-9]+]]
+; TUNIT-NEXT: [[PTR:%.*]] = call ptr @lookup_bit(ptr noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR18:[0-9]+]]
; TUNIT-NEXT: [[VAL:%.*]] = load i1, ptr [[PTR]], align 1
; TUNIT-NEXT: ret i1 [[VAL]]
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@c7
-; CGSCC-SAME: (ptr nofree readonly [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR5:[0-9]+]] {
-; CGSCC-NEXT: [[PTR:%.*]] = call ptr @lookup_bit(ptr noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR20:[0-9]+]]
+; CGSCC-SAME: (ptr nofree readonly [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR6:[0-9]+]] {
+; CGSCC-NEXT: [[PTR:%.*]] = call ptr @lookup_bit(ptr noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR21:[0-9]+]]
; CGSCC-NEXT: [[VAL:%.*]] = load i1, ptr [[PTR]], align 1
; CGSCC-NEXT: ret i1 [[VAL]]
;
@@ -207,7 +207,7 @@ define i1 @c7(ptr %q, i32 %bitno) {
define i32 @nc1(ptr %q, ptr %p, i1 %b) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@nc1
-; TUNIT-SAME: (ptr nofree [[Q:%.*]], ptr nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR4:[0-9]+]] {
+; TUNIT-SAME: (ptr nofree [[Q:%.*]], ptr nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR5:[0-9]+]] {
; TUNIT-NEXT: e:
; TUNIT-NEXT: br label [[L:%.*]]
; TUNIT: l:
@@ -221,7 +221,7 @@ define i32 @nc1(ptr %q, ptr %p, i1 %b) {
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@nc1
-; CGSCC-SAME: (ptr nofree [[Q:%.*]], ptr nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR6:[0-9]+]] {
+; CGSCC-SAME: (ptr nofree [[Q:%.*]], ptr nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR7:[0-9]+]] {
; CGSCC-NEXT: e:
; CGSCC-NEXT: br label [[L:%.*]]
; CGSCC: l:
@@ -248,7 +248,7 @@ l:
define i32 @nc1_addrspace(ptr %q, ptr addrspace(1) %p, i1 %b) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@nc1_addrspace
-; TUNIT-SAME: (ptr nofree [[Q:%.*]], ptr addrspace(1) nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR4]] {
+; TUNIT-SAME: (ptr nofree [[Q:%.*]], ptr addrspace(1) nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR5]] {
; TUNIT-NEXT: e:
; TUNIT-NEXT: br label [[L:%.*]]
; TUNIT: l:
@@ -263,7 +263,7 @@ define i32 @nc1_addrspace(ptr %q, ptr addrspace(1) %p, i1 %b) {
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@nc1_addrspace
-; CGSCC-SAME: (ptr nofree [[Q:%.*]], ptr addrspace(1) nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR6]] {
+; CGSCC-SAME: (ptr nofree [[Q:%.*]], ptr addrspace(1) nocapture nofree [[P:%.*]], i1 [[B:%.*]]) #[[ATTR7]] {
; CGSCC-NEXT: e:
; CGSCC-NEXT: br label [[L:%.*]]
; CGSCC: l:
@@ -292,14 +292,14 @@ l:
define void @nc2(ptr %p, ptr %q) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@nc2
-; TUNIT-SAME: (ptr nocapture nofree [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR4]] {
-; TUNIT-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree [[P]], i1 noundef false) #[[ATTR18:[0-9]+]]
+; TUNIT-SAME: (ptr nocapture nofree [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR5]] {
+; TUNIT-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree [[P]], i1 noundef false) #[[ATTR19:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@nc2
-; CGSCC-SAME: (ptr nocapture nofree align 4 [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR7:[0-9]+]] {
-; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR21:[0-9]+]]
+; CGSCC-SAME: (ptr nocapture nofree align 4 [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR8:[0-9]+]] {
+; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR22:[0-9]+]]
; CGSCC-NEXT: ret void
;
%1 = call i32 @nc1(ptr %q, ptr %p, i1 0) ; <i32> [#uses=0]
@@ -323,14 +323,14 @@ declare void @external(ptr readonly) nounwind argmemonly
define void @nc4(ptr %p) {
; TUNIT: Function Attrs: nounwind memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@nc4
-; TUNIT-SAME: (ptr nofree [[P:%.*]]) #[[ATTR5:[0-9]+]] {
-; TUNIT-NEXT: call void @external(ptr nofree readonly [[P]]) #[[ATTR19:[0-9]+]]
+; TUNIT-SAME: (ptr nofree [[P:%.*]]) #[[ATTR6:[0-9]+]] {
+; TUNIT-NEXT: call void @external(ptr nofree readonly [[P]]) #[[ATTR20:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nounwind memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@nc4
-; CGSCC-SAME: (ptr nofree [[P:%.*]]) #[[ATTR8:[0-9]+]] {
-; CGSCC-NEXT: call void @external(ptr nofree readonly [[P]]) #[[ATTR22:[0-9]+]]
+; CGSCC-SAME: (ptr nofree [[P:%.*]]) #[[ATTR9:[0-9]+]] {
+; CGSCC-NEXT: call void @external(ptr nofree readonly [[P]]) #[[ATTR23:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @external(ptr %p)
@@ -352,15 +352,15 @@ define void @nc5(ptr %f, ptr %p) {
define void @test1_1(ptr %x1_1, ptr %y1_1, i1 %c) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test1_1
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X1_1:%.*]], ptr nocapture nofree readnone [[Y1_1:%.*]], i1 [[C:%.*]]) #[[ATTR6:[0-9]+]] {
-; TUNIT-NEXT: [[TMP1:%.*]] = call ptr @test1_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[Y1_1]], i1 noundef [[C]]) #[[ATTR6]]
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X1_1:%.*]], ptr nocapture nofree readnone [[Y1_1:%.*]], i1 [[C:%.*]]) #[[ATTR7:[0-9]+]] {
+; TUNIT-NEXT: [[TMP1:%.*]] = call ptr @test1_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[Y1_1]], i1 noundef [[C]]) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test1_1
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X1_1:%.*]], ptr nocapture nofree readnone [[Y1_1:%.*]], i1 [[C:%.*]]) #[[ATTR9:[0-9]+]] {
-; CGSCC-NEXT: [[TMP1:%.*]] = call ptr @test1_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[Y1_1]], i1 noundef [[C]]) #[[ATTR9]]
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X1_1:%.*]], ptr nocapture nofree readnone [[Y1_1:%.*]], i1 [[C:%.*]]) #[[ATTR10:[0-9]+]] {
+; CGSCC-NEXT: [[TMP1:%.*]] = call ptr @test1_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[Y1_1]], i1 noundef [[C]]) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: ret void
;
@@ -372,10 +372,10 @@ define void @test1_1(ptr %x1_1, ptr %y1_1, i1 %c) {
define ptr @test1_2(ptr %x1_2, ptr %y1_2, i1 %c) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test1_2
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X1_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y1_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR6]] {
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X1_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y1_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR7]] {
; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; TUNIT: t:
-; TUNIT-NEXT: call void @test1_1(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone [[Y1_2]], i1 noundef [[C]]) #[[ATTR6]]
+; TUNIT-NEXT: call void @test1_1(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone [[Y1_2]], i1 noundef [[C]]) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: br label [[F]]
; TUNIT: f:
@@ -383,10 +383,10 @@ define ptr @test1_2(ptr %x1_2, ptr %y1_2, i1 %c) {
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test1_2
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X1_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y1_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR9]] {
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X1_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y1_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR10]] {
; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CGSCC: t:
-; CGSCC-NEXT: call void @test1_1(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone [[Y1_2]], i1 noundef [[C]]) #[[ATTR9]]
+; CGSCC-NEXT: call void @test1_1(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone [[Y1_2]], i1 noundef [[C]]) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: br label [[F]]
; CGSCC: f:
@@ -404,15 +404,15 @@ f:
define void @test2(ptr %x2) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test2
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X2:%.*]]) #[[ATTR6]] {
-; TUNIT-NEXT: call void @test2(ptr noalias nocapture nofree readnone undef) #[[ATTR6]]
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X2:%.*]]) #[[ATTR7]] {
+; TUNIT-NEXT: call void @test2(ptr noalias nocapture nofree readnone undef) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test2
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X2:%.*]]) #[[ATTR9]] {
-; CGSCC-NEXT: call void @test2(ptr noalias nocapture nofree readnone undef) #[[ATTR9]]
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X2:%.*]]) #[[ATTR10]] {
+; CGSCC-NEXT: call void @test2(ptr noalias nocapture nofree readnone undef) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: ret void
;
@@ -424,15 +424,15 @@ define void @test2(ptr %x2) {
define void @test3(ptr %x3, ptr %y3, ptr %z3) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test3
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X3:%.*]], ptr nocapture nofree readnone [[Y3:%.*]], ptr nocapture nofree readnone [[Z3:%.*]]) #[[ATTR6]] {
-; TUNIT-NEXT: call void @test3(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef) #[[ATTR6]]
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X3:%.*]], ptr nocapture nofree readnone [[Y3:%.*]], ptr nocapture nofree readnone [[Z3:%.*]]) #[[ATTR7]] {
+; TUNIT-NEXT: call void @test3(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test3
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X3:%.*]], ptr nocapture nofree readnone [[Y3:%.*]], ptr nocapture nofree readnone [[Z3:%.*]]) #[[ATTR9]] {
-; CGSCC-NEXT: call void @test3(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef) #[[ATTR9]]
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X3:%.*]], ptr nocapture nofree readnone [[Y3:%.*]], ptr nocapture nofree readnone [[Z3:%.*]]) #[[ATTR10]] {
+; CGSCC-NEXT: call void @test3(ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef, ptr noalias nocapture nofree readnone undef) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: ret void
;
@@ -444,15 +444,15 @@ define void @test3(ptr %x3, ptr %y3, ptr %z3) {
define void @test4_1(ptr %x4_1, i1 %c) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test4_1
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X4_1:%.*]], i1 [[C:%.*]]) #[[ATTR6]] {
-; TUNIT-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[X4_1]], ptr noalias nocapture nofree readnone undef, i1 noundef [[C]]) #[[ATTR6]]
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X4_1:%.*]], i1 [[C:%.*]]) #[[ATTR7]] {
+; TUNIT-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[X4_1]], ptr noalias nocapture nofree readnone undef, i1 noundef [[C]]) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test4_1
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X4_1:%.*]], i1 [[C:%.*]]) #[[ATTR9]] {
-; CGSCC-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[X4_1]], ptr noalias nocapture nofree readnone undef, i1 noundef [[C]]) #[[ATTR9]]
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X4_1:%.*]], i1 [[C:%.*]]) #[[ATTR10]] {
+; CGSCC-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr noalias nocapture nofree readnone undef, ptr noalias nofree readnone "no-capture-maybe-returned" [[X4_1]], ptr noalias nocapture nofree readnone undef, i1 noundef [[C]]) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: ret void
;
@@ -464,10 +464,10 @@ define void @test4_1(ptr %x4_1, i1 %c) {
define ptr @test4_2(ptr %x4_2, ptr %y4_2, ptr %z4_2, i1 %c) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test4_2
-; TUNIT-SAME: (ptr nocapture nofree readnone [[X4_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y4_2:%.*]], ptr nocapture nofree readnone [[Z4_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR6]] {
+; TUNIT-SAME: (ptr nocapture nofree readnone [[X4_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y4_2:%.*]], ptr nocapture nofree readnone [[Z4_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR7]] {
; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; TUNIT: t:
-; TUNIT-NEXT: call void @test4_1(ptr nofree noundef readnone align 4294967296 null, i1 noundef [[C]]) #[[ATTR6]]
+; TUNIT-NEXT: call void @test4_1(ptr nofree noundef readnone align 4294967296 null, i1 noundef [[C]]) #[[ATTR7]]
; TUNIT-NEXT: store ptr null, ptr @g, align 8
; TUNIT-NEXT: br label [[F]]
; TUNIT: f:
@@ -475,10 +475,10 @@ define ptr @test4_2(ptr %x4_2, ptr %y4_2, ptr %z4_2, i1 %c) {
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test4_2
-; CGSCC-SAME: (ptr nocapture nofree readnone [[X4_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y4_2:%.*]], ptr nocapture nofree readnone [[Z4_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR9]] {
+; CGSCC-SAME: (ptr nocapture nofree readnone [[X4_2:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[Y4_2:%.*]], ptr nocapture nofree readnone [[Z4_2:%.*]], i1 noundef [[C:%.*]]) #[[ATTR10]] {
; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CGSCC: t:
-; CGSCC-NEXT: call void @test4_1(ptr nofree noundef readnone align 4294967296 null, i1 noundef [[C]]) #[[ATTR9]]
+; CGSCC-NEXT: call void @test4_1(ptr nofree noundef readnone align 4294967296 null, i1 noundef [[C]]) #[[ATTR10]]
; CGSCC-NEXT: store ptr null, ptr @g, align 8
; CGSCC-NEXT: br label [[F]]
; CGSCC: f:
@@ -524,13 +524,13 @@ define void @test6_2(ptr %x6_2, ptr %y6_2, ptr %z6_2) {
define void @test_cmpxchg(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@test_cmpxchg
-; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR7:[0-9]+]] {
+; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR8:[0-9]+]] {
; TUNIT-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], i32 0, i32 1 acquire monotonic, align 4
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@test_cmpxchg
-; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR10:[0-9]+]] {
+; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR11:[0-9]+]] {
; CGSCC-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], i32 0, i32 1 acquire monotonic, align 4
; CGSCC-NEXT: ret void
;
@@ -541,13 +541,13 @@ define void @test_cmpxchg(ptr %p) {
define void @test_cmpxchg_ptr(ptr %p, ptr %q) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@test_cmpxchg_ptr
-; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR7]] {
+; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], ptr null, ptr [[Q]] acquire monotonic, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@test_cmpxchg_ptr
-; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR10]] {
+; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR11]] {
; CGSCC-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], ptr null, ptr [[Q]] acquire monotonic, align 8
; CGSCC-NEXT: ret void
;
@@ -558,13 +558,13 @@ define void @test_cmpxchg_ptr(ptr %p, ptr %q) {
define void @test_atomicrmw(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@test_atomicrmw
-; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR7]] {
+; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: [[TMP1:%.*]] = atomicrmw add ptr [[P]], i32 1 seq_cst, align 4
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@test_atomicrmw
-; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR10]] {
+; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR11]] {
; CGSCC-NEXT: [[TMP1:%.*]] = atomicrmw add ptr [[P]], i32 1 seq_cst, align 4
; CGSCC-NEXT: ret void
;
@@ -575,7 +575,7 @@ define void @test_atomicrmw(ptr %p) {
define void @test_volatile(ptr %x) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@test_volatile
-; TUNIT-SAME: (ptr nofree align 4 [[X:%.*]]) #[[ATTR7]] {
+; TUNIT-SAME: (ptr nofree align 4 [[X:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[X]], i64 1
; TUNIT-NEXT: store volatile i32 0, ptr [[GEP]], align 4
@@ -583,7 +583,7 @@ define void @test_volatile(ptr %x) {
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@test_volatile
-; CGSCC-SAME: (ptr nofree align 4 [[X:%.*]]) #[[ATTR10]] {
+; CGSCC-SAME: (ptr nofree align 4 [[X:%.*]]) #[[ATTR11]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[X]], i64 1
; CGSCC-NEXT: store volatile i32 0, ptr [[GEP]], align 4
@@ -598,17 +598,17 @@ entry:
define void @nocaptureLaunder(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@nocaptureLaunder
-; TUNIT-SAME: (ptr nocapture nofree [[P:%.*]]) #[[ATTR8:[0-9]+]] {
+; TUNIT-SAME: (ptr nocapture nofree [[P:%.*]]) #[[ATTR9:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR20:[0-9]+]]
+; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR21:[0-9]+]]
; TUNIT-NEXT: store i8 42, ptr [[B]], align 1
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@nocaptureLaunder
-; CGSCC-SAME: (ptr nocapture nofree [[P:%.*]]) #[[ATTR11:[0-9]+]] {
+; CGSCC-SAME: (ptr nocapture nofree [[P:%.*]]) #[[ATTR12:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR23:[0-9]+]]
+; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR24:[0-9]+]]
; CGSCC-NEXT: store i8 42, ptr [[B]], align 1
; CGSCC-NEXT: ret void
;
@@ -622,15 +622,15 @@ entry:
define void @captureLaunder(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@captureLaunder
-; TUNIT-SAME: (ptr nofree [[P:%.*]]) #[[ATTR4]] {
-; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR20]]
+; TUNIT-SAME: (ptr nofree [[P:%.*]]) #[[ATTR5]] {
+; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR21]]
; TUNIT-NEXT: store ptr [[B]], ptr @g2, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@captureLaunder
-; CGSCC-SAME: (ptr nofree [[P:%.*]]) #[[ATTR6]] {
-; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR23]]
+; CGSCC-SAME: (ptr nofree [[P:%.*]]) #[[ATTR7]] {
+; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr nofree [[P]]) #[[ATTR24]]
; CGSCC-NEXT: store ptr [[B]], ptr @g2, align 8
; CGSCC-NEXT: ret void
;
@@ -642,17 +642,17 @@ define void @captureLaunder(ptr %p) {
define void @nocaptureStrip(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
; TUNIT-LABEL: define {{[^@]+}}@nocaptureStrip
-; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR9:[0-9]+]] {
+; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR10:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR21:[0-9]+]]
+; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR22:[0-9]+]]
; TUNIT-NEXT: store i8 42, ptr [[B]], align 1
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CGSCC-LABEL: define {{[^@]+}}@nocaptureStrip
-; CGSCC-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR12:[0-9]+]] {
+; CGSCC-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR13:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR20]]
+; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR21]]
; CGSCC-NEXT: store i8 42, ptr [[B]], align 1
; CGSCC-NEXT: ret void
;
@@ -667,14 +667,14 @@ define void @captureStrip(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; TUNIT-LABEL: define {{[^@]+}}@captureStrip
; TUNIT-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR1]] {
-; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR21]]
+; TUNIT-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR22]]
; TUNIT-NEXT: store ptr [[B]], ptr @g3, align 8
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; CGSCC-LABEL: define {{[^@]+}}@captureStrip
; CGSCC-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR1]] {
-; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR20]]
+; CGSCC-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr noalias nofree readnone [[P]]) #[[ATTR21]]
; CGSCC-NEXT: store ptr [[B]], ptr @g3, align 8
; CGSCC-NEXT: ret void
;
@@ -741,13 +741,13 @@ define i1 @nocaptureDereferenceableOrNullICmp(ptr dereferenceable_or_null(4) %x)
define i1 @captureDereferenceableOrNullICmp(ptr dereferenceable_or_null(4) %x) null_pointer_is_valid {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@captureDereferenceableOrNullICmp
-; TUNIT-SAME: (ptr nofree noundef readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR10:[0-9]+]] {
+; TUNIT-SAME: (ptr nofree noundef readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR11:[0-9]+]] {
; TUNIT-NEXT: [[TMP1:%.*]] = icmp eq ptr [[X]], null
; TUNIT-NEXT: ret i1 [[TMP1]]
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@captureDereferenceableOrNullICmp
-; CGSCC-SAME: (ptr nofree noundef readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR13:[0-9]+]] {
+; CGSCC-SAME: (ptr nofree noundef readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR14:[0-9]+]] {
; CGSCC-NEXT: [[TMP1:%.*]] = icmp eq ptr [[X]], null
; CGSCC-NEXT: ret i1 [[TMP1]]
;
@@ -770,16 +770,16 @@ entry:
declare ptr @unknownpi8pi8(ptr,ptr returned)
define ptr @test_returned1(ptr %A, ptr returned %B) nounwind readonly {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define {{[^@]+}}@test_returned1
-; TUNIT-SAME: (ptr nocapture [[A:%.*]], ptr returned [[B:%.*]]) #[[ATTR11:[0-9]+]] {
+; TUNIT-SAME: (ptr nocapture [[A:%.*]], ptr returned [[B:%.*]]) #[[ATTR12:[0-9]+]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr [[A]], ptr [[B]])
; TUNIT-NEXT: ret ptr [[P]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define {{[^@]+}}@test_returned1
-; CGSCC-SAME: (ptr nocapture [[A:%.*]], ptr returned [[B:%.*]]) #[[ATTR14:[0-9]+]] {
+; CGSCC-SAME: (ptr nocapture [[A:%.*]], ptr returned [[B:%.*]]) #[[ATTR15:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr [[A]], ptr [[B]])
; CGSCC-NEXT: ret ptr [[P]]
@@ -790,18 +790,18 @@ entry:
}
define ptr @test_returned2(ptr %A, ptr %B) {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define {{[^@]+}}@test_returned2
-; TUNIT-SAME: (ptr readonly [[A:%.*]], ptr readonly [[B:%.*]]) #[[ATTR11]] {
+; TUNIT-SAME: (ptr readonly [[A:%.*]], ptr readonly [[B:%.*]]) #[[ATTR12]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr readonly [[A]], ptr readonly [[B]]) #[[ATTR11]]
+; TUNIT-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr readonly [[A]], ptr readonly [[B]]) #[[ATTR12]]
; TUNIT-NEXT: ret ptr [[P]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define {{[^@]+}}@test_returned2
-; CGSCC-SAME: (ptr readonly [[A:%.*]], ptr readonly [[B:%.*]]) #[[ATTR14]] {
+; CGSCC-SAME: (ptr readonly [[A:%.*]], ptr readonly [[B:%.*]]) #[[ATTR15]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr readonly [[A]], ptr readonly [[B]]) #[[ATTR14]]
+; CGSCC-NEXT: [[P:%.*]] = call ptr @unknownpi8pi8(ptr readonly [[A]], ptr readonly [[B]]) #[[ATTR15]]
; CGSCC-NEXT: ret ptr [[P]]
;
entry:
@@ -815,15 +815,15 @@ declare void @val_use(i8 %ptr) readonly nounwind willreturn
; FIXME: Both pointers should be nocapture
define void @ptr_uses(ptr %ptr, ptr %wptr) {
-; TUNIT: Function Attrs: mustprogress nounwind willreturn
+; TUNIT: Function Attrs: mustprogress nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@ptr_uses
-; TUNIT-SAME: (ptr nofree [[PTR:%.*]], ptr nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR13:[0-9]+]] {
+; TUNIT-SAME: (ptr nofree [[PTR:%.*]], ptr nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR14:[0-9]+]] {
; TUNIT-NEXT: store i8 0, ptr [[WPTR]], align 1
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress nounwind willreturn
+; CGSCC: Function Attrs: mustprogress nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@ptr_uses
-; CGSCC-SAME: (ptr nofree [[PTR:%.*]], ptr nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR16:[0-9]+]] {
+; CGSCC-SAME: (ptr nofree [[PTR:%.*]], ptr nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR17:[0-9]+]] {
; CGSCC-NEXT: store i8 0, ptr [[WPTR]], align 1
; CGSCC-NEXT: ret void
;
@@ -840,48 +840,50 @@ declare ptr @llvm.strip.invariant.group.p0(ptr)
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
-; TUNIT: attributes #[[ATTR3]] = { memory(read) }
-; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn }
-; TUNIT: attributes #[[ATTR5]] = { nounwind memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR6]] = { nofree nosync nounwind memory(write) }
-; TUNIT: attributes #[[ATTR7]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR8]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
-; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
-; TUNIT: attributes #[[ATTR10]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none) }
-; TUNIT: attributes #[[ATTR11]] = { nounwind memory(read) }
-; TUNIT: attributes #[[ATTR12:[0-9]+]] = { nounwind willreturn memory(read) }
-; TUNIT: attributes #[[ATTR13]] = { mustprogress nounwind willreturn }
-; TUNIT: attributes #[[ATTR14:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
-; TUNIT: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
-; TUNIT: attributes #[[ATTR16]] = { nofree nosync nounwind willreturn memory(write) }
-; TUNIT: attributes #[[ATTR17]] = { nofree nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR18]] = { nofree nosync nounwind willreturn }
-; TUNIT: attributes #[[ATTR19]] = { nounwind }
-; TUNIT: attributes #[[ATTR20]] = { nofree willreturn }
-; TUNIT: attributes #[[ATTR21]] = { nofree nosync willreturn }
+; TUNIT: attributes #[[ATTR3:[0-9]+]] = { memory(read) }
+; TUNIT: attributes #[[ATTR4]] = { nosync memory(read) }
+; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn }
+; TUNIT: attributes #[[ATTR6]] = { nounwind memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR7]] = { nofree nosync nounwind memory(write) }
+; TUNIT: attributes #[[ATTR8]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
+; TUNIT: attributes #[[ATTR10]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
+; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none) }
+; TUNIT: attributes #[[ATTR12]] = { nosync nounwind memory(read) }
+; TUNIT: attributes #[[ATTR13:[0-9]+]] = { nounwind willreturn memory(read) }
+; TUNIT: attributes #[[ATTR14]] = { mustprogress nosync nounwind willreturn }
+; TUNIT: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
+; TUNIT: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; TUNIT: attributes #[[ATTR17]] = { nofree nosync nounwind willreturn memory(write) }
+; TUNIT: attributes #[[ATTR18]] = { nofree nosync nounwind willreturn memory(none) }
+; TUNIT: attributes #[[ATTR19]] = { nofree nosync nounwind willreturn }
+; TUNIT: attributes #[[ATTR20]] = { nounwind }
+; TUNIT: attributes #[[ATTR21]] = { nofree willreturn }
+; TUNIT: attributes #[[ATTR22]] = { nofree nosync willreturn }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR4]] = { memory(read) }
-; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn }
-; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree nosync nounwind willreturn }
-; CGSCC: attributes #[[ATTR8]] = { nounwind memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR9]] = { nofree nosync nounwind memory(write) }
-; CGSCC: attributes #[[ATTR10]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
-; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
-; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none) }
-; CGSCC: attributes #[[ATTR14]] = { nounwind memory(read) }
-; CGSCC: attributes #[[ATTR15:[0-9]+]] = { nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR16]] = { mustprogress nounwind willreturn }
-; CGSCC: attributes #[[ATTR17:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
-; CGSCC: attributes #[[ATTR18:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
-; CGSCC: attributes #[[ATTR19]] = { nofree nounwind willreturn memory(write) }
-; CGSCC: attributes #[[ATTR20]] = { nofree nosync willreturn }
-; CGSCC: attributes #[[ATTR21]] = { nofree nounwind willreturn }
-; CGSCC: attributes #[[ATTR22]] = { nounwind }
-; CGSCC: attributes #[[ATTR23]] = { nofree willreturn }
+; CGSCC: attributes #[[ATTR4:[0-9]+]] = { memory(read) }
+; CGSCC: attributes #[[ATTR5]] = { nosync memory(read) }
+; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
+; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn }
+; CGSCC: attributes #[[ATTR8]] = { mustprogress nofree nosync nounwind willreturn }
+; CGSCC: attributes #[[ATTR9]] = { nounwind memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR10]] = { nofree nosync nounwind memory(write) }
+; CGSCC: attributes #[[ATTR11]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
+; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
+; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none) }
+; CGSCC: attributes #[[ATTR15]] = { nosync nounwind memory(read) }
+; CGSCC: attributes #[[ATTR16:[0-9]+]] = { nounwind willreturn memory(read) }
+; CGSCC: attributes #[[ATTR17]] = { mustprogress nosync nounwind willreturn }
+; CGSCC: attributes #[[ATTR18:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
+; CGSCC: attributes #[[ATTR19:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; CGSCC: attributes #[[ATTR20]] = { nofree nounwind willreturn memory(write) }
+; CGSCC: attributes #[[ATTR21]] = { nofree nosync willreturn }
+; CGSCC: attributes #[[ATTR22]] = { nofree nounwind willreturn }
+; CGSCC: attributes #[[ATTR23]] = { nounwind }
+; CGSCC: attributes #[[ATTR24]] = { nofree willreturn }
;.
diff --git a/llvm/test/Transforms/Attributor/nocapture-2.ll b/llvm/test/Transforms/Attributor/nocapture-2.ll
index c1eaf34fe0257f..7b962864f89c96 100644
--- a/llvm/test/Transforms/Attributor/nocapture-2.ll
+++ b/llvm/test/Transforms/Attributor/nocapture-2.ll
@@ -375,16 +375,16 @@ define void @test_not_captured_but_returned_calls(ptr %a) #0 {
; TUNIT-LABEL: define void @test_not_captured_but_returned_calls
; TUNIT-SAME: (ptr nocapture nofree writeonly align 8 [[A:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9:[0-9]+]]
-; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11:[0-9]+]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: write) uwtable
; CGSCC-LABEL: define void @test_not_captured_but_returned_calls
; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A:%.*]]) #[[ATTR5:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR10:[0-9]+]]
-; CGSCC-NEXT: [[CALL1:%.*]] = call ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR10]]
+; CGSCC-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR12:[0-9]+]]
+; CGSCC-NEXT: [[CALL1:%.*]] = call ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR12]]
; CGSCC-NEXT: ret void
;
entry:
@@ -405,14 +405,14 @@ define ptr @negative_test_not_captured_but_returned_call_0a(ptr %a) #0 {
; TUNIT-LABEL: define align 8 ptr @negative_test_not_captured_but_returned_call_0a
; TUNIT-SAME: (ptr nofree returned writeonly align 8 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11]]
; TUNIT-NEXT: ret ptr [[A]]
;
; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: write) uwtable
; CGSCC-LABEL: define noundef nonnull align 8 dereferenceable(8) ptr @negative_test_not_captured_but_returned_call_0a
; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR5]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR10]]
+; CGSCC-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR12]]
; CGSCC-NEXT: ret ptr [[CALL]]
;
entry:
@@ -432,7 +432,7 @@ define void @negative_test_not_captured_but_returned_call_0b(ptr %a) #0 {
; TUNIT-LABEL: define void @negative_test_not_captured_but_returned_call_0b
; TUNIT-SAME: (ptr nofree writeonly align 8 [[A:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11]]
; TUNIT-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[A]] to i64
; TUNIT-NEXT: store i64 [[TMP0]], ptr [[A]], align 8
; TUNIT-NEXT: ret void
@@ -441,7 +441,7 @@ define void @negative_test_not_captured_but_returned_call_0b(ptr %a) #0 {
; CGSCC-LABEL: define void @negative_test_not_captured_but_returned_call_0b
; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR5]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR10]]
+; CGSCC-NEXT: [[CALL:%.*]] = call ptr @not_captured_but_returned_0(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR12]]
; CGSCC-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[CALL]] to i64
; CGSCC-NEXT: store i64 [[TMP0]], ptr [[A]], align 8
; CGSCC-NEXT: ret void
@@ -465,14 +465,14 @@ define ptr @negative_test_not_captured_but_returned_call_1a(ptr %a) #0 {
; TUNIT-LABEL: define noundef nonnull align 8 dereferenceable(8) ptr @negative_test_not_captured_but_returned_call_1a
; TUNIT-SAME: (ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9]]
+; TUNIT-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: write) uwtable
; CGSCC-LABEL: define noundef nonnull align 8 dereferenceable(8) ptr @negative_test_not_captured_but_returned_call_1a
; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A:%.*]]) #[[ATTR5]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR10]]
+; CGSCC-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR12]]
; CGSCC-NEXT: ret ptr [[CALL]]
;
entry:
@@ -492,7 +492,7 @@ define void @negative_test_not_captured_but_returned_call_1b(ptr %a) #0 {
; TUNIT-LABEL: define void @negative_test_not_captured_but_returned_call_1b
; TUNIT-SAME: (ptr nofree writeonly align 8 [[A:%.*]]) #[[ATTR5:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call align 8 ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR9]]
+; TUNIT-NEXT: [[CALL:%.*]] = call align 8 ptr @not_captured_but_returned_1(ptr nofree writeonly align 8 "no-capture-maybe-returned" [[A]]) #[[ATTR11]]
; TUNIT-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[CALL]] to i64
; TUNIT-NEXT: store i64 [[TMP0]], ptr [[CALL]], align 8
; TUNIT-NEXT: ret void
@@ -501,7 +501,7 @@ define void @negative_test_not_captured_but_returned_call_1b(ptr %a) #0 {
; CGSCC-LABEL: define void @negative_test_not_captured_but_returned_call_1b
; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A:%.*]]) #[[ATTR6:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call align 8 ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR10]]
+; CGSCC-NEXT: [[CALL:%.*]] = call align 8 ptr @not_captured_but_returned_1(ptr nofree noundef nonnull writeonly align 8 dereferenceable(16) [[A]]) #[[ATTR12]]
; CGSCC-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[CALL]] to i64
; CGSCC-NEXT: store i64 [[TMP0]], ptr [[CALL]], align 8
; CGSCC-NEXT: ret void
@@ -587,18 +587,18 @@ r:
declare ptr @readonly_unknown(ptr, ptr) readonly
define void @not_captured_by_readonly_call(ptr %b) #0 {
-; TUNIT: Function Attrs: noinline nounwind memory(read) uwtable
+; TUNIT: Function Attrs: noinline nosync nounwind memory(read) uwtable
; TUNIT-LABEL: define void @not_captured_by_readonly_call
; TUNIT-SAME: (ptr nocapture readonly [[B:%.*]]) #[[ATTR7:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown(ptr readonly [[B]], ptr readonly [[B]]) #[[ATTR6:[0-9]+]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown(ptr readonly [[B]], ptr readonly [[B]]) #[[ATTR12:[0-9]+]]
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: noinline nounwind memory(read) uwtable
+; CGSCC: Function Attrs: noinline nosync nounwind memory(read) uwtable
; CGSCC-LABEL: define void @not_captured_by_readonly_call
; CGSCC-SAME: (ptr nocapture readonly [[B:%.*]]) #[[ATTR8:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown(ptr readonly [[B]], ptr readonly [[B]]) #[[ATTR7:[0-9]+]]
+; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown(ptr readonly [[B]], ptr readonly [[B]]) #[[ATTR13:[0-9]+]]
; CGSCC-NEXT: ret void
;
entry:
@@ -612,14 +612,14 @@ entry:
; Make sure the returned flag on %r is strong enough to justify nocapture on %b but **not** on %r.
;
define ptr @not_captured_by_readonly_call_not_returned_either1(ptr %b, ptr returned %r) {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either1
; TUNIT-SAME: (ptr nocapture readonly [[B:%.*]], ptr readonly returned [[R:%.*]]) #[[ATTR8:[0-9]+]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either1
; CGSCC-SAME: (ptr nocapture readonly [[B:%.*]], ptr readonly returned [[R:%.*]]) #[[ATTR9:[0-9]+]] {
; CGSCC-NEXT: entry:
@@ -633,14 +633,14 @@ entry:
declare ptr @readonly_unknown_r1a(ptr, ptr returned) readonly
define ptr @not_captured_by_readonly_call_not_returned_either2(ptr %b, ptr %r) {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either2
; TUNIT-SAME: (ptr readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1a(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either2
; CGSCC-SAME: (ptr readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR9]] {
; CGSCC-NEXT: entry:
@@ -654,14 +654,14 @@ entry:
declare ptr @readonly_unknown_r1b(ptr, ptr returned) readonly nounwind
define ptr @not_captured_by_readonly_call_not_returned_either3(ptr %b, ptr %r) {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either3
; TUNIT-SAME: (ptr nocapture readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1b(ptr nocapture readonly [[B]], ptr readonly [[R]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either3
; CGSCC-SAME: (ptr nocapture readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR9]] {
; CGSCC-NEXT: entry:
@@ -674,18 +674,18 @@ entry:
}
define ptr @not_captured_by_readonly_call_not_returned_either4(ptr %b, ptr %r) nounwind {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either4
; TUNIT-SAME: (ptr readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR8]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1a(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR6]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1a(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR12]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define ptr @not_captured_by_readonly_call_not_returned_either4
; CGSCC-SAME: (ptr readonly [[B:%.*]], ptr readonly [[R:%.*]]) #[[ATTR9]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1a(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR7]]
+; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_unknown_r1a(ptr readonly [[B]], ptr readonly [[R]]) #[[ATTR13]]
; CGSCC-NEXT: ret ptr [[CALL]]
;
entry:
@@ -711,17 +711,19 @@ entry:
declare ptr @readonly_i32p(ptr) readonly
define void @nocapture_is_not_subsumed_2(ptr nocapture %b) {
+; TUNIT: Function Attrs: nosync
; TUNIT-LABEL: define void @nocapture_is_not_subsumed_2
-; TUNIT-SAME: (ptr nocapture [[B:%.*]]) {
+; TUNIT-SAME: (ptr nocapture [[B:%.*]]) #[[ATTR10:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_i32p(ptr readonly [[B]]) #[[ATTR6]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @readonly_i32p(ptr readonly [[B]]) #[[ATTR12]]
; TUNIT-NEXT: store i32 0, ptr [[CALL]], align 4
; TUNIT-NEXT: ret void
;
+; CGSCC: Function Attrs: nosync
; CGSCC-LABEL: define void @nocapture_is_not_subsumed_2
-; CGSCC-SAME: (ptr nocapture [[B:%.*]]) {
+; CGSCC-SAME: (ptr nocapture [[B:%.*]]) #[[ATTR11:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_i32p(ptr readonly [[B]]) #[[ATTR7]]
+; CGSCC-NEXT: [[CALL:%.*]] = call ptr @readonly_i32p(ptr readonly [[B]]) #[[ATTR13]]
; CGSCC-NEXT: store i32 0, ptr [[CALL]], align 4
; CGSCC-NEXT: ret void
;
@@ -739,10 +741,13 @@ attributes #0 = { noinline nounwind uwtable }
; TUNIT: attributes #[[ATTR3]] = { noinline nounwind uwtable }
; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: write) uwtable }
; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(write) uwtable }
-; TUNIT: attributes #[[ATTR6]] = { memory(read) }
-; TUNIT: attributes #[[ATTR7]] = { noinline nounwind memory(read) uwtable }
-; TUNIT: attributes #[[ATTR8]] = { nounwind memory(read) }
-; TUNIT: attributes #[[ATTR9]] = { nofree nosync nounwind willreturn memory(write) }
+; TUNIT: attributes #[[ATTR6:[0-9]+]] = { memory(read) }
+; TUNIT: attributes #[[ATTR7]] = { noinline nosync nounwind memory(read) uwtable }
+; TUNIT: attributes #[[ATTR8]] = { nosync nounwind memory(read) }
+; TUNIT: attributes #[[ATTR9:[0-9]+]] = { nounwind memory(read) }
+; TUNIT: attributes #[[ATTR10]] = { nosync }
+; TUNIT: attributes #[[ATTR11]] = { nofree nosync nounwind willreturn memory(write) }
+; TUNIT: attributes #[[ATTR12]] = { nosync memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
@@ -751,8 +756,11 @@ attributes #0 = { noinline nounwind uwtable }
; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: write) uwtable }
; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree noinline nosync nounwind willreturn memory(argmem: write) uwtable }
; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree noinline nosync nounwind willreturn memory(write) uwtable }
-; CGSCC: attributes #[[ATTR7]] = { memory(read) }
-; CGSCC: attributes #[[ATTR8]] = { noinline nounwind memory(read) uwtable }
-; CGSCC: attributes #[[ATTR9]] = { nounwind memory(read) }
-; CGSCC: attributes #[[ATTR10]] = { nofree nounwind willreturn memory(write) }
+; CGSCC: attributes #[[ATTR7:[0-9]+]] = { memory(read) }
+; CGSCC: attributes #[[ATTR8]] = { noinline nosync nounwind memory(read) uwtable }
+; CGSCC: attributes #[[ATTR9]] = { nosync nounwind memory(read) }
+; CGSCC: attributes #[[ATTR10:[0-9]+]] = { nounwind memory(read) }
+; CGSCC: attributes #[[ATTR11]] = { nosync }
+; CGSCC: attributes #[[ATTR12]] = { nofree nounwind willreturn memory(write) }
+; CGSCC: attributes #[[ATTR13]] = { nosync memory(read) }
;.
diff --git a/llvm/test/Transforms/Attributor/nofree.ll b/llvm/test/Transforms/Attributor/nofree.ll
index 08c4c42aaaf2d3..52725e0f02fb59 100644
--- a/llvm/test/Transforms/Attributor/nofree.ll
+++ b/llvm/test/Transforms/Attributor/nofree.ll
@@ -427,7 +427,7 @@ define void @nonnull_assume_call(ptr %arg1, ptr %arg2, ptr %arg3, ptr %arg4) {
; FIXME: function is nofree
define weak void @implied_nofree1() readnone {
-; CHECK: Function Attrs: memory(none)
+; CHECK: Function Attrs: nosync memory(none)
; CHECK-LABEL: define {{[^@]+}}@implied_nofree1
; CHECK-SAME: () #[[ATTR9:[0-9]+]] {
; CHECK-NEXT: ret void
@@ -436,7 +436,7 @@ define weak void @implied_nofree1() readnone {
}
; FIXME: function is nofree
define weak void @implied_nofree2() readonly {
-; CHECK: Function Attrs: memory(read)
+; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@implied_nofree2
; CHECK-SAME: () #[[ATTR10:[0-9]+]] {
; CHECK-NEXT: ret void
@@ -459,7 +459,7 @@ define weak void @implied_nofree4(ptr readonly %a) {
}
; FIXME: %a is nofree
define weak void @implied_nofree5(ptr %a) readonly {
-; CHECK: Function Attrs: memory(read)
+; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@implied_nofree5
; CHECK-SAME: (ptr [[A:%.*]]) #[[ATTR10]] {
; CHECK-NEXT: ret void
@@ -495,8 +495,8 @@ attributes #2 = { nobuiltin nounwind }
; TUNIT: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
; TUNIT: attributes #[[ATTR7]] = { nofree nounwind }
; TUNIT: attributes #[[ATTR8]] = { nobuiltin nofree nounwind }
-; TUNIT: attributes #[[ATTR9]] = { memory(none) }
-; TUNIT: attributes #[[ATTR10]] = { memory(read) }
+; TUNIT: attributes #[[ATTR9]] = { nosync memory(none) }
+; TUNIT: attributes #[[ATTR10]] = { nosync memory(read) }
; TUNIT: attributes #[[ATTR11]] = { nofree }
; TUNIT: attributes #[[ATTR12:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; TUNIT: attributes #[[ATTR13:[0-9]+]] = { nounwind willreturn }
@@ -512,8 +512,8 @@ attributes #2 = { nobuiltin nounwind }
; CGSCC: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
; CGSCC: attributes #[[ATTR7]] = { nofree nounwind }
; CGSCC: attributes #[[ATTR8]] = { nobuiltin nofree nounwind }
-; CGSCC: attributes #[[ATTR9]] = { memory(none) }
-; CGSCC: attributes #[[ATTR10]] = { memory(read) }
+; CGSCC: attributes #[[ATTR9]] = { nosync memory(none) }
+; CGSCC: attributes #[[ATTR10]] = { nosync memory(read) }
; CGSCC: attributes #[[ATTR11]] = { nofree }
; CGSCC: attributes #[[ATTR12:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR13:[0-9]+]] = { nounwind willreturn }
diff --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll
index c8cd0e7b363237..de90f0982e214f 100644
--- a/llvm/test/Transforms/Attributor/nonnull.ll
+++ b/llvm/test/Transforms/Attributor/nonnull.ll
@@ -1390,7 +1390,7 @@ declare ptr @strrchr(ptr %0, i32 %1) nofree nounwind readonly willreturn
; We should not mark the return of @strrchr as `nonnull`, it may well be NULL!
define ptr @mybasename(ptr nofree readonly %str) {
-; TUNIT: Function Attrs: mustprogress nofree nounwind willreturn memory(read)
+; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@mybasename
; TUNIT-SAME: (ptr nofree readonly [[STR:%.*]]) #[[ATTR14:[0-9]+]] {
; TUNIT-NEXT: [[CALL:%.*]] = call ptr @strrchr(ptr nofree readonly [[STR]], i32 noundef 47) #[[ATTR18:[0-9]+]]
@@ -1399,7 +1399,7 @@ define ptr @mybasename(ptr nofree readonly %str) {
; TUNIT-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], ptr [[ADD_PTR]], ptr [[STR]]
; TUNIT-NEXT: ret ptr [[COND]]
;
-; CGSCC: Function Attrs: mustprogress nofree nounwind willreturn memory(read)
+; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@mybasename
; CGSCC-SAME: (ptr nofree readonly [[STR:%.*]]) #[[ATTR14:[0-9]+]] {
; CGSCC-NEXT: [[CALL:%.*]] = call ptr @strrchr(ptr nofree readonly [[STR]], i32 noundef 47) #[[ATTR19:[0-9]+]]
@@ -1542,11 +1542,11 @@ attributes #1 = { nounwind willreturn}
; TUNIT: attributes #[[ATTR11]] = { naked }
; TUNIT: attributes #[[ATTR12]] = { noinline optnone }
; TUNIT: attributes #[[ATTR13:[0-9]+]] = { nofree nounwind willreturn memory(read) }
-; TUNIT: attributes #[[ATTR14]] = { mustprogress nofree nounwind willreturn memory(read) }
+; TUNIT: attributes #[[ATTR14]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
; TUNIT: attributes #[[ATTR15]] = { nofree willreturn }
; TUNIT: attributes #[[ATTR16]] = { nofree nosync nounwind memory(read) }
-; TUNIT: attributes #[[ATTR17]] = { willreturn memory(read) }
-; TUNIT: attributes #[[ATTR18]] = { nofree willreturn memory(read) }
+; TUNIT: attributes #[[ATTR17]] = { nosync willreturn memory(read) }
+; TUNIT: attributes #[[ATTR18]] = { nofree nosync willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
@@ -1562,10 +1562,10 @@ attributes #1 = { nounwind willreturn}
; CGSCC: attributes #[[ATTR11]] = { naked }
; CGSCC: attributes #[[ATTR12]] = { noinline optnone }
; CGSCC: attributes #[[ATTR13:[0-9]+]] = { nofree nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree nounwind willreturn memory(read) }
+; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
; CGSCC: attributes #[[ATTR15]] = { nofree willreturn }
; CGSCC: attributes #[[ATTR16]] = { nofree nosync nounwind memory(read) }
-; CGSCC: attributes #[[ATTR17]] = { willreturn memory(read) }
+; CGSCC: attributes #[[ATTR17]] = { nosync willreturn memory(read) }
; CGSCC: attributes #[[ATTR18]] = { nofree nosync willreturn }
-; CGSCC: attributes #[[ATTR19]] = { nofree willreturn memory(read) }
+; CGSCC: attributes #[[ATTR19]] = { nofree nosync willreturn memory(read) }
;.
diff --git a/llvm/test/Transforms/Attributor/norecurse.ll b/llvm/test/Transforms/Attributor/norecurse.ll
index d2929e1ca8c854..b0034e465018ed 100644
--- a/llvm/test/Transforms/Attributor/norecurse.ll
+++ b/llvm/test/Transforms/Attributor/norecurse.ll
@@ -54,7 +54,7 @@ define i32 @extern() {
; CHECK: Function Attrs: nosync memory(none)
; CHECK-LABEL: define {{[^@]+}}@extern
; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT: [[A:%.*]] = call i32 @k()
+; CHECK-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR9:[0-9]+]]
; CHECK-NEXT: ret i32 [[A]]
;
%a = call i32 @k()
@@ -69,7 +69,7 @@ define void @intrinsic(ptr %dest, ptr %src, i32 %len) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
; CHECK-LABEL: define {{[^@]+}}@intrinsic
; CHECK-SAME: (ptr nocapture nofree writeonly [[DEST:%.*]], ptr nocapture nofree readonly [[SRC:%.*]], i32 [[LEN:%.*]]) #[[ATTR4:[0-9]+]] {
-; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i32 [[LEN]], i1 noundef false) #[[ATTR9:[0-9]+]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i32 [[LEN]], i1 noundef false) #[[ATTR10:[0-9]+]]
; CHECK-NEXT: ret void
;
call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 %len, i1 false)
@@ -84,7 +84,7 @@ define internal i32 @called_by_norecurse() {
; CHECK: Function Attrs: norecurse nosync memory(none)
; CHECK-LABEL: define {{[^@]+}}@called_by_norecurse
; CHECK-SAME: () #[[ATTR6:[0-9]+]] {
-; CHECK-NEXT: [[A:%.*]] = call i32 @k()
+; CHECK-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR9]]
; CHECK-NEXT: ret i32 undef
;
%a = call i32 @k()
@@ -100,7 +100,7 @@ define void @m() norecurse {
; CGSCC: Function Attrs: norecurse nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@m
; CGSCC-SAME: () #[[ATTR6]] {
-; CGSCC-NEXT: [[A:%.*]] = call i32 @called_by_norecurse() #[[ATTR10:[0-9]+]]
+; CGSCC-NEXT: [[A:%.*]] = call i32 @called_by_norecurse() #[[ATTR9]]
; CGSCC-NEXT: ret void
;
%a = call i32 @called_by_norecurse()
@@ -111,13 +111,13 @@ define internal i32 @called_by_norecurse_indirectly() {
; TUNIT: Function Attrs: norecurse nosync memory(none)
; TUNIT-LABEL: define {{[^@]+}}@called_by_norecurse_indirectly
; TUNIT-SAME: () #[[ATTR6]] {
-; TUNIT-NEXT: [[A:%.*]] = call i32 @k()
+; TUNIT-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR9]]
; TUNIT-NEXT: ret i32 [[A]]
;
; CGSCC: Function Attrs: nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@called_by_norecurse_indirectly
; CGSCC-SAME: () #[[ATTR2]] {
-; CGSCC-NEXT: [[A:%.*]] = call i32 @k()
+; CGSCC-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR9]]
; CGSCC-NEXT: ret i32 [[A]]
;
%a = call i32 @k()
@@ -133,7 +133,7 @@ define internal i32 @o() {
; CGSCC: Function Attrs: norecurse nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@o
; CGSCC-SAME: () #[[ATTR6]] {
-; CGSCC-NEXT: [[A:%.*]] = call i32 @called_by_norecurse_indirectly() #[[ATTR10]]
+; CGSCC-NEXT: [[A:%.*]] = call i32 @called_by_norecurse_indirectly() #[[ATTR9]]
; CGSCC-NEXT: ret i32 [[A]]
;
%a = call i32 @called_by_norecurse_indirectly()
@@ -149,7 +149,7 @@ define i32 @p() norecurse {
; CGSCC: Function Attrs: norecurse nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@p
; CGSCC-SAME: () #[[ATTR6]] {
-; CGSCC-NEXT: [[A:%.*]] = call i32 @o() #[[ATTR10]]
+; CGSCC-NEXT: [[A:%.*]] = call i32 @o() #[[ATTR9]]
; CGSCC-NEXT: ret i32 [[A]]
;
%a = call i32 @o()
@@ -307,26 +307,15 @@ f:
}
;.
-; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR2]] = { nosync memory(none) }
-; TUNIT: attributes #[[ATTR3:[0-9]+]] = { memory(none) }
-; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR6]] = { norecurse nosync memory(none) }
-; TUNIT: attributes #[[ATTR7]] = { null_pointer_is_valid }
-; TUNIT: attributes #[[ATTR8]] = { norecurse }
-; TUNIT: attributes #[[ATTR9]] = { nofree willreturn }
-;.
-; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
-; CGSCC: attributes #[[ATTR2]] = { nosync memory(none) }
-; CGSCC: attributes #[[ATTR3:[0-9]+]] = { memory(none) }
-; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR6]] = { norecurse nosync memory(none) }
-; CGSCC: attributes #[[ATTR7]] = { null_pointer_is_valid }
-; CGSCC: attributes #[[ATTR8]] = { norecurse }
-; CGSCC: attributes #[[ATTR9]] = { nofree willreturn }
-; CGSCC: attributes #[[ATTR10]] = { nosync }
+; CHECK: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
+; CHECK: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
+; CHECK: attributes #[[ATTR2]] = { nosync memory(none) }
+; CHECK: attributes #[[ATTR3:[0-9]+]] = { memory(none) }
+; CHECK: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
+; CHECK: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
+; CHECK: attributes #[[ATTR6]] = { norecurse nosync memory(none) }
+; CHECK: attributes #[[ATTR7]] = { null_pointer_is_valid }
+; CHECK: attributes #[[ATTR8:[0-9]+]] = { norecurse }
+; CHECK: attributes #[[ATTR9]] = { nosync }
+; CHECK: attributes #[[ATTR10]] = { nofree willreturn }
;.
diff --git a/llvm/test/Transforms/Attributor/readattrs.ll b/llvm/test/Transforms/Attributor/readattrs.ll
index 18d3a95f29b629..429068b47b020c 100644
--- a/llvm/test/Transforms/Attributor/readattrs.ll
+++ b/llvm/test/Transforms/Attributor/readattrs.ll
@@ -50,10 +50,10 @@ define i1 @test3(ptr %p, ptr %q) {
declare void @test4_1(ptr nocapture) readonly
define void @test4_2(ptr %p) {
-; CHECK: Function Attrs: memory(read)
+; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@test4_2
-; CHECK-SAME: (ptr nocapture readonly [[P:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT: call void @test4_1(ptr nocapture readonly [[P]]) #[[ATTR2]]
+; CHECK-SAME: (ptr nocapture readonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
+; CHECK-NEXT: call void @test4_1(ptr nocapture readonly [[P]]) #[[ATTR3]]
; CHECK-NEXT: ret void
;
call void @test4_1(ptr %p)
@@ -64,7 +64,7 @@ define void @test4_2(ptr %p) {
define void @test5(ptr %p, ptr %q) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@test5
-; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], ptr nofree writeonly [[Q:%.*]]) #[[ATTR3:[0-9]+]] {
+; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], ptr nofree writeonly [[Q:%.*]]) #[[ATTR4:[0-9]+]] {
; CHECK-NEXT: store ptr [[Q]], ptr [[P]], align 8
; CHECK-NEXT: ret void
;
@@ -110,16 +110,16 @@ entry:
define void @test8_2(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
; TUNIT-LABEL: define {{[^@]+}}@test8_2
-; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR3]] {
+; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: store i32 10, ptr [[P]], align 4
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)
; CGSCC-LABEL: define {{[^@]+}}@test8_2
-; CGSCC-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
+; CGSCC-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR5:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[CALL:%.*]] = call align 4 ptr @test8_1(ptr noalias nofree readnone [[P]]) #[[ATTR13:[0-9]+]]
+; CGSCC-NEXT: [[CALL:%.*]] = call align 4 ptr @test8_1(ptr noalias nofree readnone [[P]]) #[[ATTR17:[0-9]+]]
; CGSCC-NEXT: store i32 10, ptr [[CALL]], align 4
; CGSCC-NEXT: ret void
;
@@ -138,13 +138,13 @@ define void @test9(<4 x ptr> %ptrs, <4 x i32>%val) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test9
; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] {
-; TUNIT-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR12:[0-9]+]]
+; TUNIT-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR16:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test9
; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] {
-; CGSCC-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR14:[0-9]+]]
+; CGSCC-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR18:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>%val, <4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>)
@@ -156,14 +156,14 @@ declare <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr>, i32, <4 x i1>, <4 x
define <4 x i32> @test10(<4 x ptr> %ptrs) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@test10
-; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR6:[0-9]+]] {
-; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR13:[0-9]+]]
+; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] {
+; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR17:[0-9]+]]
; TUNIT-NEXT: ret <4 x i32> [[RES]]
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@test10
-; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] {
-; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR15:[0-9]+]]
+; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR8:[0-9]+]] {
+; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR19:[0-9]+]]
; CGSCC-NEXT: ret <4 x i32> [[RES]]
;
%res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>, <4 x i32>undef)
@@ -173,16 +173,16 @@ define <4 x i32> @test10(<4 x ptr> %ptrs) {
; CHECK: declare <4 x i32> @test11_1
declare <4 x i32> @test11_1(<4 x ptr>) argmemonly nounwind readonly
define <4 x i32> @test11_2(<4 x ptr> %ptrs) {
-; TUNIT: Function Attrs: nounwind memory(argmem: read)
+; TUNIT: Function Attrs: nosync nounwind memory(argmem: read)
; TUNIT-LABEL: define {{[^@]+}}@test11_2
-; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] {
-; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR11:[0-9]+]]
+; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {
+; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR15:[0-9]+]]
; TUNIT-NEXT: ret <4 x i32> [[RES]]
;
-; CGSCC: Function Attrs: nounwind memory(argmem: read)
+; CGSCC: Function Attrs: nosync nounwind memory(argmem: read)
; CGSCC-LABEL: define {{[^@]+}}@test11_2
-; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR8:[0-9]+]] {
-; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR12:[0-9]+]]
+; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR10:[0-9]+]] {
+; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR16:[0-9]+]]
; CGSCC-NEXT: ret <4 x i32> [[RES]]
;
%res = call <4 x i32> @test11_1(<4 x ptr> %ptrs)
@@ -194,14 +194,14 @@ declare <4 x i32> @test12_1(<4 x ptr>) argmemonly nounwind
define <4 x i32> @test12_2(<4 x ptr> %ptrs) {
; TUNIT: Function Attrs: nounwind memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@test12_2
-; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR8:[0-9]+]] {
-; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR14:[0-9]+]]
+; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR10:[0-9]+]] {
+; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR18:[0-9]+]]
; TUNIT-NEXT: ret <4 x i32> [[RES]]
;
; CGSCC: Function Attrs: nounwind memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@test12_2
-; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {
-; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR16:[0-9]+]]
+; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR11:[0-9]+]] {
+; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR20:[0-9]+]]
; CGSCC-NEXT: ret <4 x i32> [[RES]]
;
%res = call <4 x i32> @test12_1(<4 x ptr> %ptrs)
@@ -211,13 +211,13 @@ define <4 x i32> @test12_2(<4 x ptr> %ptrs) {
define i32 @volatile_load(ptr %p) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@volatile_load
-; TUNIT-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR9:[0-9]+]] {
+; TUNIT-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR11:[0-9]+]] {
; TUNIT-NEXT: [[LOAD:%.*]] = load volatile i32, ptr [[P]], align 4
; TUNIT-NEXT: ret i32 [[LOAD]]
;
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@volatile_load
-; CGSCC-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR10:[0-9]+]] {
+; CGSCC-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR12:[0-9]+]] {
; CGSCC-NEXT: [[LOAD:%.*]] = load volatile i32, ptr [[P]], align 4
; CGSCC-NEXT: ret i32 [[LOAD]]
;
@@ -271,9 +271,9 @@ define void @unsound_readonly(ptr %ignored, ptr %escaped_then_written) {
declare void @escape_i8(ptr %ptr)
define void @byval_not_readonly_1(ptr byval(i8) %written) readonly {
-; CHECK: Function Attrs: memory(read)
+; CHECK: Function Attrs: nosync memory(read)
; CHECK-LABEL: define {{[^@]+}}@byval_not_readonly_1
-; CHECK-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR3]] {
; CHECK-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])
; CHECK-NEXT: ret void
;
@@ -293,15 +293,15 @@ define void @byval_not_readonly_2(ptr byval(i8) %written) readonly {
}
define void @byval_not_readnone_1(ptr byval(i8) %written) readnone {
-; TUNIT: Function Attrs: memory(none)
+; TUNIT: Function Attrs: nosync memory(none)
; TUNIT-LABEL: define {{[^@]+}}@byval_not_readnone_1
-; TUNIT-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR10:[0-9]+]] {
+; TUNIT-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR12:[0-9]+]] {
; TUNIT-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: memory(none)
+; CGSCC: Function Attrs: nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@byval_not_readnone_1
-; CGSCC-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR11:[0-9]+]] {
+; CGSCC-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR13:[0-9]+]] {
; CGSCC-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])
; CGSCC-NEXT: ret void
;
@@ -323,7 +323,7 @@ define void @byval_not_readnone_2(ptr byval(i8) %written) readnone {
define void @byval_no_fnarg(ptr byval(i8) %written) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@byval_no_fnarg
-; CHECK-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR3]] {
+; CHECK-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR4]] {
; CHECK-NEXT: store i8 0, ptr [[WRITTEN]], align 1
; CHECK-NEXT: ret void
;
@@ -332,18 +332,20 @@ define void @byval_no_fnarg(ptr byval(i8) %written) {
}
define void @testbyval(ptr %read_only) {
+; TUNIT: Function Attrs: nosync
; TUNIT-LABEL: define {{[^@]+}}@testbyval
-; TUNIT-SAME: (ptr nocapture nonnull readonly [[READ_ONLY:%.*]]) {
-; TUNIT-NEXT: call void @byval_not_readonly_1(ptr noalias nocapture nonnull readonly byval(i8) [[READ_ONLY]]) #[[ATTR2]]
-; TUNIT-NEXT: call void @byval_not_readnone_1(ptr noalias nocapture nonnull readnone byval(i8) [[READ_ONLY]])
-; TUNIT-NEXT: call void @byval_no_fnarg(ptr noalias nocapture nofree noundef nonnull readonly byval(i8) [[READ_ONLY]]) #[[ATTR15:[0-9]+]]
+; TUNIT-SAME: (ptr nocapture nonnull readonly [[READ_ONLY:%.*]]) #[[ATTR13:[0-9]+]] {
+; TUNIT-NEXT: call void @byval_not_readonly_1(ptr noalias nocapture nonnull readonly byval(i8) [[READ_ONLY]]) #[[ATTR3]]
+; TUNIT-NEXT: call void @byval_not_readnone_1(ptr noalias nocapture nonnull readnone byval(i8) [[READ_ONLY]]) #[[ATTR13]]
+; TUNIT-NEXT: call void @byval_no_fnarg(ptr noalias nocapture nofree noundef nonnull readonly byval(i8) [[READ_ONLY]]) #[[ATTR19:[0-9]+]]
; TUNIT-NEXT: ret void
;
+; CGSCC: Function Attrs: nosync
; CGSCC-LABEL: define {{[^@]+}}@testbyval
-; CGSCC-SAME: (ptr nocapture noundef nonnull readonly dereferenceable(1) [[READ_ONLY:%.*]]) {
-; CGSCC-NEXT: call void @byval_not_readonly_1(ptr noalias nocapture noundef nonnull readonly byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR2]]
-; CGSCC-NEXT: call void @byval_not_readnone_1(ptr noalias nocapture noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]])
-; CGSCC-NEXT: call void @byval_no_fnarg(ptr noalias nocapture nofree noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR17:[0-9]+]]
+; CGSCC-SAME: (ptr nocapture noundef nonnull readonly dereferenceable(1) [[READ_ONLY:%.*]]) #[[ATTR14:[0-9]+]] {
+; CGSCC-NEXT: call void @byval_not_readonly_1(ptr noalias nocapture noundef nonnull readonly byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR2:[0-9]+]]
+; CGSCC-NEXT: call void @byval_not_readnone_1(ptr noalias nocapture noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR14]]
+; CGSCC-NEXT: call void @byval_no_fnarg(ptr noalias nocapture nofree noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR21:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @byval_not_readonly_1(ptr byval(i8) %read_only)
@@ -360,18 +362,18 @@ declare i8 @maybe_returned_val(ptr %ptr) readonly nounwind
declare void @val_use(i8 %ptr) readonly nounwind
define void @ptr_uses(ptr %ptr) {
-; TUNIT: Function Attrs: nounwind memory(read)
+; TUNIT: Function Attrs: nosync nounwind memory(read)
; TUNIT-LABEL: define {{[^@]+}}@ptr_uses
-; TUNIT-SAME: (ptr nocapture nofree readonly [[PTR:%.*]]) #[[ATTR11]] {
-; TUNIT-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR11]]
-; TUNIT-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR11]]
+; TUNIT-SAME: (ptr nocapture nofree readonly [[PTR:%.*]]) #[[ATTR15]] {
+; TUNIT-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR15]]
+; TUNIT-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR15]]
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: nounwind memory(read)
+; CGSCC: Function Attrs: nosync nounwind memory(read)
; CGSCC-LABEL: define {{[^@]+}}@ptr_uses
-; CGSCC-SAME: (ptr nocapture nofree readonly [[PTR:%.*]]) #[[ATTR12]] {
-; CGSCC-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR12]]
-; CGSCC-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR12]]
+; CGSCC-SAME: (ptr nocapture nofree readonly [[PTR:%.*]]) #[[ATTR16]] {
+; CGSCC-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR16]]
+; CGSCC-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR16]]
; CGSCC-NEXT: ret void
;
%call_ptr = call ptr @maybe_returned_ptr(ptr %ptr)
@@ -404,37 +406,45 @@ define i32 @read_only_constant_mem() {
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR2]] = { memory(read) }
-; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
-; TUNIT: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }
-; TUNIT: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }
-; TUNIT: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
-; TUNIT: attributes #[[ATTR7]] = { nounwind memory(argmem: read) }
-; TUNIT: attributes #[[ATTR8]] = { nounwind memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR10]] = { memory(none) }
-; TUNIT: attributes #[[ATTR11]] = { nounwind memory(read) }
-; TUNIT: attributes #[[ATTR12]] = { nofree willreturn memory(write) }
-; TUNIT: attributes #[[ATTR13]] = { nofree willreturn memory(read) }
-; TUNIT: attributes #[[ATTR14]] = { nounwind }
-; TUNIT: attributes #[[ATTR15]] = { nounwind memory(write) }
+; TUNIT: attributes #[[ATTR2:[0-9]+]] = { memory(read) }
+; TUNIT: attributes #[[ATTR3]] = { nosync memory(read) }
+; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
+; TUNIT: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }
+; TUNIT: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }
+; TUNIT: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
+; TUNIT: attributes #[[ATTR8:[0-9]+]] = { nounwind memory(argmem: read) }
+; TUNIT: attributes #[[ATTR9]] = { nosync nounwind memory(argmem: read) }
+; TUNIT: attributes #[[ATTR10]] = { nounwind memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR12]] = { nosync memory(none) }
+; TUNIT: attributes #[[ATTR13]] = { nosync }
+; TUNIT: attributes #[[ATTR14:[0-9]+]] = { nounwind memory(read) }
+; TUNIT: attributes #[[ATTR15]] = { nosync nounwind memory(read) }
+; TUNIT: attributes #[[ATTR16]] = { nofree willreturn memory(write) }
+; TUNIT: attributes #[[ATTR17]] = { nofree willreturn memory(read) }
+; TUNIT: attributes #[[ATTR18]] = { nounwind }
+; TUNIT: attributes #[[ATTR19]] = { nosync nounwind memory(write) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { memory(read) }
-; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
-; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) }
-; CGSCC: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }
-; CGSCC: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
-; CGSCC: attributes #[[ATTR8]] = { nounwind memory(argmem: read) }
-; CGSCC: attributes #[[ATTR9]] = { nounwind memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR10]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR11]] = { memory(none) }
-; CGSCC: attributes #[[ATTR12]] = { nounwind memory(read) }
-; CGSCC: attributes #[[ATTR13]] = { nofree nosync willreturn }
-; CGSCC: attributes #[[ATTR14]] = { nofree willreturn memory(write) }
-; CGSCC: attributes #[[ATTR15]] = { nofree willreturn memory(read) }
-; CGSCC: attributes #[[ATTR16]] = { nounwind }
-; CGSCC: attributes #[[ATTR17]] = { nounwind memory(write) }
+; CGSCC: attributes #[[ATTR3]] = { nosync memory(read) }
+; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
+; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) }
+; CGSCC: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }
+; CGSCC: attributes #[[ATTR7:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }
+; CGSCC: attributes #[[ATTR8]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
+; CGSCC: attributes #[[ATTR9:[0-9]+]] = { nounwind memory(argmem: read) }
+; CGSCC: attributes #[[ATTR10]] = { nosync nounwind memory(argmem: read) }
+; CGSCC: attributes #[[ATTR11]] = { nounwind memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR13]] = { nosync memory(none) }
+; CGSCC: attributes #[[ATTR14]] = { nosync }
+; CGSCC: attributes #[[ATTR15:[0-9]+]] = { nounwind memory(read) }
+; CGSCC: attributes #[[ATTR16]] = { nosync nounwind memory(read) }
+; CGSCC: attributes #[[ATTR17]] = { nofree nosync willreturn }
+; CGSCC: attributes #[[ATTR18]] = { nofree willreturn memory(write) }
+; CGSCC: attributes #[[ATTR19]] = { nofree willreturn memory(read) }
+; CGSCC: attributes #[[ATTR20]] = { nounwind }
+; CGSCC: attributes #[[ATTR21]] = { nounwind memory(write) }
;.
diff --git a/llvm/test/Transforms/Attributor/value-simplify-dbg.ll b/llvm/test/Transforms/Attributor/value-simplify-dbg.ll
index 5912cbdb132b96..4f55b055b3ad45 100644
--- a/llvm/test/Transforms/Attributor/value-simplify-dbg.ll
+++ b/llvm/test/Transforms/Attributor/value-simplify-dbg.ll
@@ -28,7 +28,7 @@ define void @src() norecurse !dbg !22 {
; CHECK-LABEL: define {{[^@]+}}@src
; CHECK-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG22:![0-9]+]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG23:![0-9]+]]
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @speculatable() #[[ATTR2:[0-9]+]], !dbg [[DBG23:![0-9]+]]
; CHECK-NEXT: [[PLUS1:%.*]] = add i32 [[CALL]], 1
; CHECK-NEXT: store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG24:![0-9]+]]
; CHECK-NEXT: ret void, !dbg [[DBG25:![0-9]+]]
@@ -75,6 +75,7 @@ declare i32 @speculatable() speculatable readnone
;.
; CHECK: attributes #[[ATTR0]] = { norecurse nosync memory(write) }
; CHECK: attributes #[[ATTR1:[0-9]+]] = { speculatable memory(none) }
+; CHECK: attributes #[[ATTR2]] = { nosync }
;.
; CHECK: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
; CHECK: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true)
diff --git a/llvm/test/Transforms/Attributor/value-simplify.ll b/llvm/test/Transforms/Attributor/value-simplify.ll
index 3dfe633f6f3034..42903977238925 100644
--- a/llvm/test/Transforms/Attributor/value-simplify.ll
+++ b/llvm/test/Transforms/Attributor/value-simplify.ll
@@ -1310,21 +1310,21 @@ define i32 @test_speculatable_expr() norecurse {
; TUNIT-LABEL: define {{[^@]+}}@test_speculatable_expr
; TUNIT-SAME: () #[[ATTR7:[0-9]+]] {
; TUNIT-NEXT: [[STACK:%.*]] = alloca i32, align 4
-; TUNIT-NEXT: [[SPEC_RESULT:%.*]] = call i32 @speculatable()
+; TUNIT-NEXT: [[SPEC_RESULT:%.*]] = call i32 @speculatable() #[[ATTR14:[0-9]+]]
; TUNIT-NEXT: [[PLUS1:%.*]] = add i32 [[SPEC_RESULT]], 1
; TUNIT-NEXT: store i32 [[PLUS1]], ptr [[STACK]], align 4
; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[STACK]], align 4
-; TUNIT-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[TMP1]]) #[[ATTR14:[0-9]+]]
+; TUNIT-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[TMP1]]) #[[ATTR15:[0-9]+]]
; TUNIT-NEXT: ret i32 [[RSPEC]]
;
; CGSCC: Function Attrs: norecurse nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@test_speculatable_expr
; CGSCC-SAME: () #[[ATTR9:[0-9]+]] {
; CGSCC-NEXT: [[STACK:%.*]] = alloca i32, align 4
-; CGSCC-NEXT: [[SPEC_RESULT:%.*]] = call i32 @speculatable()
+; CGSCC-NEXT: [[SPEC_RESULT:%.*]] = call i32 @speculatable() #[[ATTR17:[0-9]+]]
; CGSCC-NEXT: [[PLUS1:%.*]] = add i32 [[SPEC_RESULT]], 1
; CGSCC-NEXT: store i32 [[PLUS1]], ptr [[STACK]], align 4
-; CGSCC-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[PLUS1]]) #[[ATTR17:[0-9]+]]
+; CGSCC-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[PLUS1]]) #[[ATTR17]]
; CGSCC-NEXT: ret i32 [[RSPEC]]
;
%stack = alloca i32
@@ -1513,7 +1513,8 @@ define i1 @constexpr_icmp2() {
; TUNIT: attributes #[[ATTR11]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR12]] = { nofree willreturn memory(readwrite) }
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn }
-; TUNIT: attributes #[[ATTR14]] = { nosync nounwind memory(read) }
+; TUNIT: attributes #[[ATTR14]] = { nosync }
+; TUNIT: attributes #[[ATTR15]] = { nosync nounwind memory(read) }
;.
; CGSCC: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
diff --git a/llvm/test/Transforms/Attributor/willreturn.ll b/llvm/test/Transforms/Attributor/willreturn.ll
index 41e8ec79c039a9..1e15e89473cf09 100644
--- a/llvm/test/Transforms/Attributor/willreturn.ll
+++ b/llvm/test/Transforms/Attributor/willreturn.ll
@@ -1143,16 +1143,16 @@ define void @willreturn_mustprogress_caller_1() mustprogress {
ret void
}
define void @willreturn_mustprogress_caller_2() mustprogress {
-; TUNIT: Function Attrs: mustprogress willreturn memory(read)
+; TUNIT: Function Attrs: mustprogress nosync willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@willreturn_mustprogress_caller_2
; TUNIT-SAME: () #[[ATTR23:[0-9]+]] {
-; TUNIT-NEXT: call void @readonly() #[[ATTR19:[0-9]+]]
+; TUNIT-NEXT: call void @readonly() #[[ATTR34:[0-9]+]]
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress willreturn memory(read)
+; CGSCC: Function Attrs: mustprogress nosync willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@willreturn_mustprogress_caller_2
; CGSCC-SAME: () #[[ATTR24:[0-9]+]] {
-; CGSCC-NEXT: call void @readonly() #[[ATTR20:[0-9]+]]
+; CGSCC-NEXT: call void @readonly() #[[ATTR35:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @readonly()
@@ -1162,13 +1162,13 @@ define void @willreturn_mustprogress_caller_3() mustprogress {
; TUNIT: Function Attrs: mustprogress nosync willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@willreturn_mustprogress_caller_3
; TUNIT-SAME: () #[[ATTR24:[0-9]+]] {
-; TUNIT-NEXT: call void @readnone()
+; TUNIT-NEXT: call void @readnone() #[[ATTR35:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nosync willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@willreturn_mustprogress_caller_3
; CGSCC-SAME: () #[[ATTR25:[0-9]+]] {
-; CGSCC-NEXT: call void @readnone()
+; CGSCC-NEXT: call void @readnone() #[[ATTR36:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @readnone()
@@ -1183,16 +1183,16 @@ define void @willreturn_mustprogress_callee_1() {
ret void
}
define void @willreturn_mustprogress_callee_2() {
-; TUNIT: Function Attrs: mustprogress willreturn memory(read)
+; TUNIT: Function Attrs: mustprogress nosync willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@willreturn_mustprogress_callee_2
; TUNIT-SAME: () #[[ATTR23]] {
-; TUNIT-NEXT: call void @readonly_mustprogress() #[[ATTR34:[0-9]+]]
+; TUNIT-NEXT: call void @readonly_mustprogress() #[[ATTR36:[0-9]+]]
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress willreturn memory(read)
+; CGSCC: Function Attrs: mustprogress nosync willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@willreturn_mustprogress_callee_2
; CGSCC-SAME: () #[[ATTR24]] {
-; CGSCC-NEXT: call void @readonly_mustprogress() #[[ATTR35:[0-9]+]]
+; CGSCC-NEXT: call void @readonly_mustprogress() #[[ATTR37:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @readonly_mustprogress()
@@ -1207,16 +1207,16 @@ define void @willreturn_mustprogress_callee_3() {
ret void
}
define void @willreturn_mustprogress_callee_4() {
-; TUNIT: Function Attrs: mustprogress willreturn memory(read)
+; TUNIT: Function Attrs: mustprogress nosync willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@willreturn_mustprogress_callee_4
; TUNIT-SAME: () #[[ATTR23]] {
-; TUNIT-NEXT: call void @willreturn_mustprogress_callee_2() #[[ATTR34]]
+; TUNIT-NEXT: call void @willreturn_mustprogress_callee_2() #[[ATTR36]]
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress willreturn memory(read)
+; CGSCC: Function Attrs: mustprogress nosync willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@willreturn_mustprogress_callee_4
; CGSCC-SAME: () #[[ATTR24]] {
-; CGSCC-NEXT: call void @willreturn_mustprogress_callee_2() #[[ATTR35]]
+; CGSCC-NEXT: call void @willreturn_mustprogress_callee_2() #[[ATTR38:[0-9]+]]
; CGSCC-NEXT: ret void
;
call void @willreturn_mustprogress_callee_2()
@@ -1237,25 +1237,25 @@ define weak void @implied_mustprogress1() willreturn {
ret void
}
define weak void @implied_willreturn1() readnone mustprogress {
-; TUNIT: Function Attrs: mustprogress willreturn memory(none)
+; TUNIT: Function Attrs: mustprogress nosync willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@implied_willreturn1
-; TUNIT-SAME: () #[[ATTR26:[0-9]+]] {
+; TUNIT-SAME: () #[[ATTR24]] {
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress willreturn memory(none)
+; CGSCC: Function Attrs: mustprogress nosync willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@implied_willreturn1
-; CGSCC-SAME: () #[[ATTR27:[0-9]+]] {
+; CGSCC-SAME: () #[[ATTR25]] {
; CGSCC-NEXT: ret void
;
ret void
}
define weak void @implied_willreturn2() readonly mustprogress {
-; TUNIT: Function Attrs: mustprogress willreturn memory(read)
+; TUNIT: Function Attrs: mustprogress nosync willreturn memory(read)
; TUNIT-LABEL: define {{[^@]+}}@implied_willreturn2
; TUNIT-SAME: () #[[ATTR23]] {
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: mustprogress willreturn memory(read)
+; CGSCC: Function Attrs: mustprogress nosync willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@implied_willreturn2
; CGSCC-SAME: () #[[ATTR24]] {
; CGSCC-NEXT: ret void
@@ -1276,14 +1276,14 @@ define weak void @not_implied_willreturn1() mustprogress {
ret void
}
define weak void @not_implied_willreturn2() readnone {
-; TUNIT: Function Attrs: memory(none)
+; TUNIT: Function Attrs: nosync memory(none)
; TUNIT-LABEL: define {{[^@]+}}@not_implied_willreturn2
-; TUNIT-SAME: () #[[ATTR20:[0-9]+]] {
+; TUNIT-SAME: () #[[ATTR26:[0-9]+]] {
; TUNIT-NEXT: ret void
;
-; CGSCC: Function Attrs: memory(none)
+; CGSCC: Function Attrs: nosync memory(none)
; CGSCC-LABEL: define {{[^@]+}}@not_implied_willreturn2
-; CGSCC-SAME: () #[[ATTR21:[0-9]+]] {
+; CGSCC-SAME: () #[[ATTR27:[0-9]+]] {
; CGSCC-NEXT: ret void
;
ret void
@@ -1311,14 +1311,14 @@ attributes #1 = { uwtable noinline }
; TUNIT: attributes #[[ATTR16:[0-9]+]] = { noreturn nounwind }
; TUNIT: attributes #[[ATTR17]] = { nofree norecurse nosync nounwind memory(none) }
; TUNIT: attributes #[[ATTR18]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR19]] = { memory(read) }
-; TUNIT: attributes #[[ATTR20]] = { memory(none) }
+; TUNIT: attributes #[[ATTR19:[0-9]+]] = { memory(read) }
+; TUNIT: attributes #[[ATTR20:[0-9]+]] = { memory(none) }
; TUNIT: attributes #[[ATTR21]] = { mustprogress }
; TUNIT: attributes #[[ATTR22:[0-9]+]] = { mustprogress memory(read) }
-; TUNIT: attributes #[[ATTR23]] = { mustprogress willreturn memory(read) }
+; TUNIT: attributes #[[ATTR23]] = { mustprogress nosync willreturn memory(read) }
; TUNIT: attributes #[[ATTR24]] = { mustprogress nosync willreturn memory(none) }
; TUNIT: attributes #[[ATTR25]] = { mustprogress willreturn }
-; TUNIT: attributes #[[ATTR26]] = { mustprogress willreturn memory(none) }
+; TUNIT: attributes #[[ATTR26]] = { nosync memory(none) }
; TUNIT: attributes #[[ATTR27]] = { nofree nosync nounwind memory(none) }
; TUNIT: attributes #[[ATTR28]] = { nofree nounwind willreturn }
; TUNIT: attributes #[[ATTR29]] = { nofree nosync nounwind }
@@ -1326,7 +1326,9 @@ attributes #1 = { uwtable noinline }
; TUNIT: attributes #[[ATTR31]] = { nounwind }
; TUNIT: attributes #[[ATTR32]] = { willreturn }
; TUNIT: attributes #[[ATTR33]] = { nounwind willreturn }
-; TUNIT: attributes #[[ATTR34]] = { willreturn memory(read) }
+; TUNIT: attributes #[[ATTR34]] = { nosync memory(read) }
+; TUNIT: attributes #[[ATTR35]] = { nosync }
+; TUNIT: attributes #[[ATTR36]] = { nosync willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { nofree noinline nosync nounwind memory(none) uwtable }
@@ -1348,14 +1350,14 @@ attributes #1 = { uwtable noinline }
; CGSCC: attributes #[[ATTR17]] = { nofree norecurse nosync nounwind memory(none) }
; CGSCC: attributes #[[ATTR18]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR19]] = { nofree nosync nounwind memory(none) }
-; CGSCC: attributes #[[ATTR20]] = { memory(read) }
-; CGSCC: attributes #[[ATTR21]] = { memory(none) }
+; CGSCC: attributes #[[ATTR20:[0-9]+]] = { memory(read) }
+; CGSCC: attributes #[[ATTR21:[0-9]+]] = { memory(none) }
; CGSCC: attributes #[[ATTR22]] = { mustprogress }
; CGSCC: attributes #[[ATTR23:[0-9]+]] = { mustprogress memory(read) }
-; CGSCC: attributes #[[ATTR24]] = { mustprogress willreturn memory(read) }
+; CGSCC: attributes #[[ATTR24]] = { mustprogress nosync willreturn memory(read) }
; CGSCC: attributes #[[ATTR25]] = { mustprogress nosync willreturn memory(none) }
; CGSCC: attributes #[[ATTR26]] = { mustprogress willreturn }
-; CGSCC: attributes #[[ATTR27]] = { mustprogress willreturn memory(none) }
+; CGSCC: attributes #[[ATTR27]] = { nosync memory(none) }
; CGSCC: attributes #[[ATTR28]] = { nofree nounwind willreturn }
; CGSCC: attributes #[[ATTR29]] = { nofree nosync nounwind }
; CGSCC: attributes #[[ATTR30]] = { nofree nosync willreturn }
@@ -1363,5 +1365,8 @@ attributes #1 = { uwtable noinline }
; CGSCC: attributes #[[ATTR32]] = { willreturn }
; CGSCC: attributes #[[ATTR33]] = { nounwind willreturn }
; CGSCC: attributes #[[ATTR34]] = { nofree nosync }
-; CGSCC: attributes #[[ATTR35]] = { willreturn memory(read) }
+; CGSCC: attributes #[[ATTR35]] = { nosync memory(read) }
+; CGSCC: attributes #[[ATTR36]] = { nosync }
+; CGSCC: attributes #[[ATTR37]] = { nosync willreturn memory(read) }
+; CGSCC: attributes #[[ATTR38]] = { willreturn memory(read) }
;.
diff --git a/llvm/test/Transforms/OpenMP/parallel_deletion.ll b/llvm/test/Transforms/OpenMP/parallel_deletion.ll
index c1d8bcbcf8a072..6319875fd90568 100644
--- a/llvm/test/Transforms/OpenMP/parallel_deletion.ll
+++ b/llvm/test/Transforms/OpenMP/parallel_deletion.ll
@@ -49,7 +49,7 @@ define internal void @.omp_outlined.willreturn(ptr noalias %.global_tid., ptr no
; CHECK-LABEL: define {{[^@]+}}@.omp_outlined.willreturn
; CHECK-SAME: (ptr noalias nocapture nofree readnone [[DOTGLOBAL_TID_:%.*]], ptr noalias nocapture nofree readnone [[DOTBOUND_TID_:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @unknown() #[[ATTR14:[0-9]+]]
+; CHECK-NEXT: call void @unknown() #[[ATTR15:[0-9]+]]
; CHECK-NEXT: ret void
;
; CHECK1-LABEL: define {{[^@]+}}@.omp_outlined.willreturn
@@ -93,7 +93,7 @@ define internal void @.omp_outlined.willreturn.1(ptr noalias %.global_tid., ptr
; CHECK-LABEL: define {{[^@]+}}@.omp_outlined.willreturn.1
; CHECK-SAME: (ptr noalias nocapture nofree readnone [[DOTGLOBAL_TID_:%.*]], ptr noalias nocapture nofree readnone [[DOTBOUND_TID_:%.*]]) #[[ATTR2:[0-9]+]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @readnone() #[[ATTR14]]
+; CHECK-NEXT: call void @readnone() #[[ATTR16:[0-9]+]]
; CHECK-NEXT: ret void
;
; CHECK1-LABEL: define {{[^@]+}}@.omp_outlined.willreturn.1
@@ -217,7 +217,7 @@ define internal void @.omp_outlined..1(ptr noalias %.global_tid., ptr noalias %.
; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..1
; CHECK-SAME: (ptr noalias nocapture nofree readnone [[DOTGLOBAL_TID_:%.*]], ptr noalias nocapture nofree readnone [[DOTBOUND_TID_:%.*]]) #[[ATTR5:[0-9]+]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @readnone()
+; CHECK-NEXT: call void @readnone() #[[ATTR17:[0-9]+]]
; CHECK-NEXT: ret void
;
; CHECK1-LABEL: define {{[^@]+}}@.omp_outlined..1
@@ -282,7 +282,7 @@ define void @delete_parallel_2() {
; CHECK-LABEL: define {{[^@]+}}@delete_parallel_2() {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noundef nonnull align 4 dereferenceable(4) [[A]]) #[[ATTR15:[0-9]+]]
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noundef nonnull align 4 dereferenceable(4) [[A]]) #[[ATTR18:[0-9]+]]
; CHECK-NEXT: store i32 0, ptr [[A]], align 4
; CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB0]], i32 noundef 1, ptr noundef nonnull @.omp_outlined..3, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A]])
; CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB0]], i32 noundef 1, ptr noundef nonnull @.omp_outlined..4, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A]])
@@ -329,7 +329,7 @@ define internal void @.omp_outlined..3(ptr noalias %.global_tid., ptr noalias %.
; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..3
; CHECK-SAME: (ptr noalias nocapture nofree readnone [[DOTGLOBAL_TID_:%.*]], ptr noalias nocapture nofree readnone [[DOTBOUND_TID_:%.*]], ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR6:[0-9]+]] {
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @omp_get_thread_num() #[[ATTR16:[0-9]+]]
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @omp_get_thread_num() #[[ATTR19:[0-9]+]]
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CHECK: if.then:
@@ -457,7 +457,7 @@ define internal void @.omp_outlined..5(ptr noalias %.global_tid., ptr noalias %.
; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..5
; CHECK-SAME: (ptr noalias nocapture nofree readonly [[DOTGLOBAL_TID_:%.*]], ptr noalias nocapture nofree readnone [[DOTBOUND_TID_:%.*]], ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) {
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr noundef nonnull @[[GLOB0]]) #[[ATTR16]]
+; CHECK-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr noundef nonnull @[[GLOB0]]) #[[ATTR19]]
; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[DOTGLOBAL_TID_]], align 4
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @__kmpc_single(ptr noundef nonnull @[[GLOB0]], i32 [[TMP]])
; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
@@ -531,7 +531,7 @@ define internal void @.omp_outlined..6(ptr noalias %.global_tid., ptr noalias %.
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A1:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
-; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noundef nonnull align 4 [[A1]]) #[[ATTR17:[0-9]+]]
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noundef nonnull align 4 [[A1]]) #[[ATTR20:[0-9]+]]
; CHECK-NEXT: store i32 1, ptr [[A1]], align 4
; CHECK-NEXT: store ptr [[A1]], ptr [[DOTOMP_REDUCTION_RED_LIST]], align 8
; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTGLOBAL_TID_]], align 4
More information about the llvm-commits
mailing list