Skip to content

Commit 304f1d5

Browse files
committed
[IR] Switch everything to use memory attribute
This switches everything to use the memory attribute proposed in https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579. The old argmemonly, inaccessiblememonly and inaccessiblemem_or_argmemonly attributes are dropped. The readnone, readonly and writeonly attributes are restricted to parameters only. The old attributes are auto-upgraded both in bitcode and IR. The bitcode upgrade is a policy requirement that has to be retained indefinitely. The IR upgrade is mainly there so it's not necessary to update all tests using memory attributes in this patch, which is already large enough. We could drop that part after migrating tests, or retain it longer term, to make it easier to import IR from older LLVM versions. High-level Function/CallBase APIs like doesNotAccessMemory() or setDoesNotAccessMemory() are mapped transparently to the memory attribute. Code that directly manipulates attributes (e.g. via AttributeList) on the other hand needs to switch to working with the memory attribute instead. Differential Revision: https://reviews.llvm.org/D135780
1 parent 529a932 commit 304f1d5

File tree

256 files changed

+3686
-3501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+3686
-3501
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,15 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
21212121
// The NoBuiltinAttr attached to the target FunctionDecl.
21222122
const NoBuiltinAttr *NBA = nullptr;
21232123

2124+
// Some ABIs may result in additional accesses to arguments that may
2125+
// otherwise not be present.
2126+
auto AddPotentialArgAccess = [&]() {
2127+
llvm::Attribute A = FuncAttrs.getAttribute(llvm::Attribute::Memory);
2128+
if (A.isValid())
2129+
FuncAttrs.addMemoryAttr(A.getMemoryEffects() |
2130+
llvm::MemoryEffects::argMemOnly());
2131+
};
2132+
21242133
// Collect function IR attributes based on declaration-specific
21252134
// information.
21262135
// FIXME: handle sseregparm someday...
@@ -2167,18 +2176,18 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
21672176

21682177
// 'const', 'pure' and 'noalias' attributed functions are also nounwind.
21692178
if (TargetDecl->hasAttr<ConstAttr>()) {
2170-
FuncAttrs.addAttribute(llvm::Attribute::ReadNone);
2179+
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::none());
21712180
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
21722181
// gcc specifies that 'const' functions have greater restrictions than
21732182
// 'pure' functions, so they also cannot have infinite loops.
21742183
FuncAttrs.addAttribute(llvm::Attribute::WillReturn);
21752184
} else if (TargetDecl->hasAttr<PureAttr>()) {
2176-
FuncAttrs.addAttribute(llvm::Attribute::ReadOnly);
2185+
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::readOnly());
21772186
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
21782187
// gcc specifies that 'pure' functions cannot have infinite loops.
21792188
FuncAttrs.addAttribute(llvm::Attribute::WillReturn);
21802189
} else if (TargetDecl->hasAttr<NoAliasAttr>()) {
2181-
FuncAttrs.addAttribute(llvm::Attribute::ArgMemOnly);
2190+
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::argMemOnly());
21822191
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
21832192
}
21842193
if (TargetDecl->hasAttr<RestrictAttr>())
@@ -2356,8 +2365,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
23562365
case ABIArgInfo::InAlloca:
23572366
case ABIArgInfo::Indirect: {
23582367
// inalloca and sret disable readnone and readonly
2359-
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
2360-
.removeAttribute(llvm::Attribute::ReadNone);
2368+
AddPotentialArgAccess();
23612369
break;
23622370
}
23632371

@@ -2527,9 +2535,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
25272535
Attrs.addAlignmentAttr(Align.getQuantity());
25282536

25292537
// byval disables readnone and readonly.
2530-
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
2531-
.removeAttribute(llvm::Attribute::ReadNone);
2532-
2538+
AddPotentialArgAccess();
25332539
break;
25342540
}
25352541
case ABIArgInfo::IndirectAliased: {
@@ -2545,8 +2551,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
25452551

25462552
case ABIArgInfo::InAlloca:
25472553
// inalloca disables readnone and readonly.
2548-
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
2549-
.removeAttribute(llvm::Attribute::ReadNone);
2554+
AddPotentialArgAccess();
25502555
continue;
25512556
}
25522557

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,14 +737,17 @@ class ObjCNonFragileABITypesHelper : public ObjCCommonTypesHelper {
737737
// Also it is safe to make it readnone, since we never load or store the
738738
// classref except by calling this function.
739739
llvm::Type *params[] = { Int8PtrPtrTy };
740+
llvm::LLVMContext &C = CGM.getLLVMContext();
741+
llvm::AttributeSet AS = llvm::AttributeSet::get(C, {
742+
llvm::Attribute::get(C, llvm::Attribute::NonLazyBind),
743+
llvm::Attribute::getWithMemoryEffects(C, llvm::MemoryEffects::none()),
744+
llvm::Attribute::get(C, llvm::Attribute::NoUnwind),
745+
});
740746
llvm::FunctionCallee F = CGM.CreateRuntimeFunction(
741747
llvm::FunctionType::get(ClassnfABIPtrTy, params, false),
742748
"objc_loadClassref",
743749
llvm::AttributeList::get(CGM.getLLVMContext(),
744-
llvm::AttributeList::FunctionIndex,
745-
{llvm::Attribute::NonLazyBind,
746-
llvm::Attribute::ReadNone,
747-
llvm::Attribute::NoUnwind}));
750+
llvm::AttributeList::FunctionIndex, AS));
748751
if (!CGM.getTriple().isOSBinFormatCOFF())
749752
cast<llvm::Function>(F.getCallee())->setLinkage(
750753
llvm::Function::ExternalWeakLinkage);

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,9 @@ static llvm::FunctionCallee getItaniumDynamicCastFn(CodeGenFunction &CGF) {
13251325
llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, Args, false);
13261326

13271327
// Mark the function as nounwind readonly.
1328-
llvm::Attribute::AttrKind FuncAttrs[] = { llvm::Attribute::NoUnwind,
1329-
llvm::Attribute::ReadOnly };
1328+
llvm::AttrBuilder FuncAttrs(CGF.getLLVMContext());
1329+
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
1330+
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::readOnly());
13301331
llvm::AttributeList Attrs = llvm::AttributeList::get(
13311332
CGF.getLLVMContext(), llvm::AttributeList::FunctionIndex, FuncAttrs);
13321333

clang/test/CodeGen/asm-attrs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
// CHECK: call void asm sideeffect "foo7", {{.*}} [[NOATTRS]]
1111
// CHECK: call i32 asm "foo8", {{.*}} [[READNONE]]
1212

13-
// CHECK: attributes [[READNONE]] = { nounwind readnone }
13+
// CHECK: attributes [[READNONE]] = { nounwind memory(none) }
1414
// CHECK: attributes [[NOATTRS]] = { nounwind }
15-
// CHECK: attributes [[READONLY]] = { nounwind readonly }
15+
// CHECK: attributes [[READONLY]] = { nounwind memory(read) }
1616

1717
int g0, g1;
1818

clang/test/CodeGen/builtin-sqrt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ float foo(float X) {
88
}
99

1010
// HAS_ERRNO: declare float @sqrtf(float noundef) [[ATTR:#[0-9]+]]
11-
// HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone
11+
// HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} memory(none)
1212

1313
// NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]]
14-
// NO_ERRNO: attributes [[ATTR]] = { nocallback nofree nosync nounwind readnone {{.*}}}
14+
// NO_ERRNO: attributes [[ATTR]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
1515

clang/test/CodeGen/complex-builtins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ void foo(float f) {
197197
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl(ptr noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
198198
};
199199

200-
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
200+
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
201201
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
202202

203203
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
204-
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
204+
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
205205
// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} }

clang/test/CodeGen/complex-libcalls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ void foo(float f) {
197197
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl(ptr noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
198198
};
199199

200-
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
200+
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
201201
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
202202

203203
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
204-
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
204+
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
205205
// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} }

clang/test/CodeGen/function-attributes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ void f20(void) {
111111

112112
// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
113113
// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
114-
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
114+
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize willreturn memory(none){{.*}} }
115115
// CHECK: attributes [[SR]] = { nounwind optsize{{.*}} "stackrealign"{{.*}} }
116116
// CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
117117
// CHECK: attributes [[NR]] = { noreturn optsize }
118-
// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone willreturn }
118+
// CHECK: attributes [[NUW_RN]] = { nounwind optsize willreturn memory(none) }
119119
// CHECK: attributes [[RT_CALL]] = { optsize returns_twice }

clang/test/CodeGen/libcall-declarations.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,8 @@ void *use[] = {
614614
// CHECK-ERRNO: declare { double, double } @ctanh(double noundef, double noundef) [[NONCONST]]
615615
// CHECK-ERRNO: declare <2 x float> @ctanhf(<2 x float> noundef) [[NONCONST]]
616616

617-
// CHECK-NOERRNO: attributes [[NUWRN]] = { nounwind readnone{{.*}} }
618-
// CHECK-NOERRNO: attributes [[NUWRO]] = { nounwind readonly{{.*}} }
617+
// CHECK-NOERRNO: attributes [[NUWRN]] = { nounwind willreturn memory(none){{.*}} }
618+
// CHECK-NOERRNO: attributes [[NUWRO]] = { nounwind willreturn memory(read){{.*}} }
619619

620-
// CHECK-ERRNO: attributes [[NUWRN]] = { nounwind readnone{{.*}} }
621-
// CHECK-ERRNO: attributes [[NUWRO]] = { nounwind readonly{{.*}} }
620+
// CHECK-ERRNO: attributes [[NUWRN]] = { nounwind willreturn memory(none){{.*}} }
621+
// CHECK-ERRNO: attributes [[NUWRO]] = { nounwind willreturn memory(read){{.*}} }

clang/test/CodeGen/libcalls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,5 @@ void test_builtins(double d, float f, long double ld) {
124124
}
125125

126126
// CHECK-YES: attributes [[NUW]] = { nounwind "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+x87" }
127-
// CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
128-
// CHECK-NO-DAG: attributes [[NUW_RNI]] = { nocallback nofree nosync nounwind readnone speculatable willreturn }
127+
// CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind willreturn memory(none){{.*}} }
128+
// CHECK-NO-DAG: attributes [[NUW_RNI]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

clang/test/CodeGen/math-builtins.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,16 +680,16 @@ __builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); __builtin
680680
// HAS_ERRNO: declare fp128 @llvm.trunc.f128(fp128) [[READNONE_INTRINSIC]]
681681
};
682682

683-
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
684-
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
683+
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
684+
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
685685
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
686-
// NO__ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
686+
// NO__ERRNO: attributes [[PURE]] = { {{.*}}memory(read){{.*}} }
687687

688688
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
689-
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
690-
// HAS_ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
691-
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
689+
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
690+
// HAS_ERRNO: attributes [[PURE]] = { {{.*}}memory(read){{.*}} }
691+
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
692692

693-
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
694-
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
693+
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
694+
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
695695

clang/test/CodeGen/math-libcalls.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -704,18 +704,18 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
704704
// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
705705
};
706706

707-
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
708-
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
707+
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
708+
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
709709
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
710-
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
710+
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }
711711

712712
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
713-
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
714-
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
715-
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
713+
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
714+
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }
715+
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
716716

717717
// HAS_MAYTRAP: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
718-
// HAS_MAYTRAP: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
718+
// HAS_MAYTRAP: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
719719

720-
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
721-
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
720+
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
721+
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }

clang/test/CodeGen/ms-declspecs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ void noalias_caller(int *x) { noalias_callee(x); }
4141
// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
4242
// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
4343
// CHECK: attributes [[NR]] = { noreturn }
44-
// CHECK: attributes [[NA]] = { argmemonly nounwind{{.*}} }
44+
// CHECK: attributes [[NA]] = { nounwind memory(argmem: readwrite){{.*}} }

clang/test/CodeGen/pragma-weak.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ void zzz(void){}
202202
int correct_linkage;
203203

204204
// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
205-
// CHECK: attributes [[RN]] = { noinline nounwind optnone readnone{{.*}} }
205+
// CHECK: attributes [[RN]] = { noinline nounwind optnone willreturn memory(none){{.*}} }

clang/test/CodeGen/struct-passing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ void *ps[] = { f0, f1, f2, f3, f4, f5 };
2323
// CHECK: declare void @f4({{.*}} byval({{.*}}) align 4)
2424
// CHECK: declare void @f5({{.*}} byval({{.*}}) align 4)
2525

26-
// CHECK: attributes [[RN]] = { nounwind readnone{{.*}} }
27-
// CHECK: attributes [[RO]] = { nounwind readonly{{.*}} }
26+
// CHECK: attributes [[RN]] = { nounwind willreturn memory(none){{.*}} }
27+
// CHECK: attributes [[RO]] = { nounwind willreturn memory(read){{.*}} }

clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ int f(void) {
1515
// CHECK: declare noundef i32 @_Z1tv() [[TF2:#[0-9]+]]
1616

1717
// CHECK: attributes [[TF]] = { {{.*}} }
18-
// CHECK: attributes [[NUW_RN]] = { nounwind readnone willreturn{{.*}} }
19-
// CHECK: attributes [[NUW_RO]] = { nounwind readonly willreturn{{.*}} }
18+
// CHECK: attributes [[NUW_RN]] = { nounwind willreturn memory(none){{.*}} }
19+
// CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read){{.*}} }
2020
// CHECK: attributes [[TF2]] = { {{.*}} }
21-
// CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone willreturn }
22-
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn }
21+
// CHECK: attributes [[NUW_RN_CALL]] = { nounwind willreturn memory(none) }
22+
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind willreturn memory(read) }

clang/test/CodeGenCXX/dynamic-cast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ const B& f(A *a) {
2020

2121
// CHECK: declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) [[NUW_RO:#[0-9]+]]
2222

23-
// CHECK: attributes [[NUW_RO]] = { nounwind readonly }
23+
// CHECK: attributes [[NUW_RO]] = { nounwind memory(read) }
2424
// CHECK: attributes [[NR]] = { noreturn }

clang/test/CodeGenCXX/threadlocal_address.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ int f() {
5151
// CHECK-O1-NEXT: store i32 %[[INC]], ptr %[[J_ADDR]]
5252
// CHECK-O1-NEXT: ret i32 %[[INC]]
5353
//
54-
// CHECK: attributes #[[ATTR_NUM]] = { nocallback nofree nosync nounwind readnone speculatable willreturn }
54+
// CHECK: attributes #[[ATTR_NUM]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

clang/test/CodeGenObjC/class-stubs.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ - (void) anotherInstanceMethod {
8181
@end
8282

8383
// -- calls to objc_loadClassRef() are readnone
84-
// CHECK: attributes [[ATTRLIST]] = { nounwind nonlazybind readnone }
84+
// CHECK: attributes [[ATTRLIST]] = { nounwind nonlazybind memory(none) }

clang/test/CodeGenOpenCL/builtins-amdgcn.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ kernel void test_s_setreg(uint val) {
796796

797797
// CHECK-DAG: [[$WI_RANGE]] = !{i32 0, i32 1024}
798798
// CHECK-DAG: [[$WS_RANGE]] = !{i16 1, i16 1025}
799-
// CHECK-DAG: attributes #[[$NOUNWIND_READONLY:[0-9]+]] = { nofree nounwind readonly }
799+
// CHECK-DAG: attributes #[[$NOUNWIND_READONLY:[0-9]+]] = { nofree nounwind memory(read) }
800800
// CHECK-DAG: attributes #[[$READ_EXEC_ATTRS]] = { convergent }
801801
// CHECK-DAG: ![[$EXEC]] = !{!"exec"}
802802
// CHECK-DAG: ![[$EXEC_LO]] = !{!"exec_lo"}

clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ void test_generic_optionality(float a, float *b) {
4949
}
5050

5151
// CHECK: attributes [[ATTR_CONST]] =
52-
// CHECK-SAME: readnone
52+
// CHECK-SAME: memory(none)
5353
// CHECK: attributes [[ATTR_PURE]] =
54-
// CHECK-SAME: readonly
54+
// CHECK-SAME: memory(read)

clang/test/OpenMP/barrier_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int main(int argc, char **argv) {
4545
// CLANGCG: declare i32 @__kmpc_global_thread_num(ptr)
4646
// IRBUILDER: ; Function Attrs: nounwind
4747
// IRBUILDER-NEXT: declare i32 @__kmpc_global_thread_num(ptr) #
48-
// IRBUILDER_OPT: ; Function Attrs: inaccessiblememonly nofree nosync nounwind readonly
48+
// IRBUILDER_OPT: ; Function Attrs: nofree nosync nounwind willreturn memory(inaccessiblemem: read)
4949
// IRBUILDER_OPT-NEXT: declare i32 @__kmpc_global_thread_num(ptr nocapture nofree readonly) #
5050

5151
// CHECK: define {{.+}} [[TMAIN_INT]](

clang/test/OpenMP/irbuilder_simd_aligned.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void simple(float *a, float *b, int *c) {
164164
//.
165165
// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
166166
// CHECK: attributes #1 = { noinline nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
167-
// CHECK: attributes #2 = { inaccessiblememonly nocallback nofree nosync nounwind willreturn }
167+
// CHECK: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
168168
//.
169169
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
170170
// CHECK: !1 = !{i32 7, !"openmp", i32 50}

clang/test/Sema/libbuiltins-ctype-powerpc64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ void test(int x) {
6161
// CHECK: declare signext i32 @tolower(i32 noundef signext) [[NUW_RO:#[0-9]+]]
6262
// CHECK: declare signext i32 @toupper(i32 noundef signext) [[NUW_RO:#[0-9]+]]
6363

64-
// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
65-
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn }
64+
// CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read){{.*}} }
65+
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind willreturn memory(read) }

clang/test/Sema/libbuiltins-ctype-x86_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ void test(int x) {
6161
// CHECK: declare i32 @tolower(i32 noundef) [[NUW_RO:#[0-9]+]]
6262
// CHECK: declare i32 @toupper(i32 noundef) [[NUW_RO:#[0-9]+]]
6363

64-
// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
65-
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn }
64+
// CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read){{.*}} }
65+
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind willreturn memory(read) }

0 commit comments

Comments
 (0)