Skip to content

Commit

Permalink
[IR] Switch everything to use memory attribute
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nikic committed Nov 4, 2022
1 parent 529a932 commit 304f1d5
Show file tree
Hide file tree
Showing 256 changed files with 3,686 additions and 3,501 deletions.
25 changes: 15 additions & 10 deletions clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,15 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
// The NoBuiltinAttr attached to the target FunctionDecl.
const NoBuiltinAttr *NBA = nullptr;

// Some ABIs may result in additional accesses to arguments that may
// otherwise not be present.
auto AddPotentialArgAccess = [&]() {
llvm::Attribute A = FuncAttrs.getAttribute(llvm::Attribute::Memory);
if (A.isValid())
FuncAttrs.addMemoryAttr(A.getMemoryEffects() |
llvm::MemoryEffects::argMemOnly());
};

// Collect function IR attributes based on declaration-specific
// information.
// FIXME: handle sseregparm someday...
Expand Down Expand Up @@ -2167,18 +2176,18 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,

// 'const', 'pure' and 'noalias' attributed functions are also nounwind.
if (TargetDecl->hasAttr<ConstAttr>()) {
FuncAttrs.addAttribute(llvm::Attribute::ReadNone);
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::none());
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
// gcc specifies that 'const' functions have greater restrictions than
// 'pure' functions, so they also cannot have infinite loops.
FuncAttrs.addAttribute(llvm::Attribute::WillReturn);
} else if (TargetDecl->hasAttr<PureAttr>()) {
FuncAttrs.addAttribute(llvm::Attribute::ReadOnly);
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::readOnly());
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
// gcc specifies that 'pure' functions cannot have infinite loops.
FuncAttrs.addAttribute(llvm::Attribute::WillReturn);
} else if (TargetDecl->hasAttr<NoAliasAttr>()) {
FuncAttrs.addAttribute(llvm::Attribute::ArgMemOnly);
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::argMemOnly());
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
}
if (TargetDecl->hasAttr<RestrictAttr>())
Expand Down Expand Up @@ -2356,8 +2365,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
case ABIArgInfo::InAlloca:
case ABIArgInfo::Indirect: {
// inalloca and sret disable readnone and readonly
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
.removeAttribute(llvm::Attribute::ReadNone);
AddPotentialArgAccess();
break;
}

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

// byval disables readnone and readonly.
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
.removeAttribute(llvm::Attribute::ReadNone);

AddPotentialArgAccess();
break;
}
case ABIArgInfo::IndirectAliased: {
Expand All @@ -2545,8 +2551,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,

case ABIArgInfo::InAlloca:
// inalloca disables readnone and readonly.
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
.removeAttribute(llvm::Attribute::ReadNone);
AddPotentialArgAccess();
continue;
}

Expand Down
11 changes: 7 additions & 4 deletions clang/lib/CodeGen/CGObjCMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,17 @@ class ObjCNonFragileABITypesHelper : public ObjCCommonTypesHelper {
// Also it is safe to make it readnone, since we never load or store the
// classref except by calling this function.
llvm::Type *params[] = { Int8PtrPtrTy };
llvm::LLVMContext &C = CGM.getLLVMContext();
llvm::AttributeSet AS = llvm::AttributeSet::get(C, {
llvm::Attribute::get(C, llvm::Attribute::NonLazyBind),
llvm::Attribute::getWithMemoryEffects(C, llvm::MemoryEffects::none()),
llvm::Attribute::get(C, llvm::Attribute::NoUnwind),
});
llvm::FunctionCallee F = CGM.CreateRuntimeFunction(
llvm::FunctionType::get(ClassnfABIPtrTy, params, false),
"objc_loadClassref",
llvm::AttributeList::get(CGM.getLLVMContext(),
llvm::AttributeList::FunctionIndex,
{llvm::Attribute::NonLazyBind,
llvm::Attribute::ReadNone,
llvm::Attribute::NoUnwind}));
llvm::AttributeList::FunctionIndex, AS));
if (!CGM.getTriple().isOSBinFormatCOFF())
cast<llvm::Function>(F.getCallee())->setLinkage(
llvm::Function::ExternalWeakLinkage);
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/CodeGen/ItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,9 @@ static llvm::FunctionCallee getItaniumDynamicCastFn(CodeGenFunction &CGF) {
llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, Args, false);

// Mark the function as nounwind readonly.
llvm::Attribute::AttrKind FuncAttrs[] = { llvm::Attribute::NoUnwind,
llvm::Attribute::ReadOnly };
llvm::AttrBuilder FuncAttrs(CGF.getLLVMContext());
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
FuncAttrs.addMemoryAttr(llvm::MemoryEffects::readOnly());
llvm::AttributeList Attrs = llvm::AttributeList::get(
CGF.getLLVMContext(), llvm::AttributeList::FunctionIndex, FuncAttrs);

Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/asm-attrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// CHECK: call void asm sideeffect "foo7", {{.*}} [[NOATTRS]]
// CHECK: call i32 asm "foo8", {{.*}} [[READNONE]]

// CHECK: attributes [[READNONE]] = { nounwind readnone }
// CHECK: attributes [[READNONE]] = { nounwind memory(none) }
// CHECK: attributes [[NOATTRS]] = { nounwind }
// CHECK: attributes [[READONLY]] = { nounwind readonly }
// CHECK: attributes [[READONLY]] = { nounwind memory(read) }

int g0, g1;

Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/builtin-sqrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ float foo(float X) {
}

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

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

4 changes: 2 additions & 2 deletions clang/test/CodeGen/complex-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ void foo(float f) {
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl(ptr noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
};

// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }

// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} }
4 changes: 2 additions & 2 deletions clang/test/CodeGen/complex-libcalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ void foo(float f) {
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl(ptr noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
};

// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }

// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} }
4 changes: 2 additions & 2 deletions clang/test/CodeGen/function-attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ void f20(void) {

// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize willreturn memory(none){{.*}} }
// CHECK: attributes [[SR]] = { nounwind optsize{{.*}} "stackrealign"{{.*}} }
// CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
// CHECK: attributes [[NR]] = { noreturn optsize }
// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone willreturn }
// CHECK: attributes [[NUW_RN]] = { nounwind optsize willreturn memory(none) }
// CHECK: attributes [[RT_CALL]] = { optsize returns_twice }
8 changes: 4 additions & 4 deletions clang/test/CodeGen/libcall-declarations.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ void *use[] = {
// CHECK-ERRNO: declare { double, double } @ctanh(double noundef, double noundef) [[NONCONST]]
// CHECK-ERRNO: declare <2 x float> @ctanhf(<2 x float> noundef) [[NONCONST]]

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

// CHECK-ERRNO: attributes [[NUWRN]] = { nounwind readnone{{.*}} }
// CHECK-ERRNO: attributes [[NUWRO]] = { nounwind readonly{{.*}} }
// CHECK-ERRNO: attributes [[NUWRN]] = { nounwind willreturn memory(none){{.*}} }
// CHECK-ERRNO: attributes [[NUWRO]] = { nounwind willreturn memory(read){{.*}} }
4 changes: 2 additions & 2 deletions clang/test/CodeGen/libcalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ void test_builtins(double d, float f, long double ld) {
}

// CHECK-YES: attributes [[NUW]] = { nounwind "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+x87" }
// CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
// CHECK-NO-DAG: attributes [[NUW_RNI]] = { nocallback nofree nosync nounwind readnone speculatable willreturn }
// CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind willreturn memory(none){{.*}} }
// CHECK-NO-DAG: attributes [[NUW_RNI]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
16 changes: 8 additions & 8 deletions clang/test/CodeGen/math-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,16 +680,16 @@ __builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); __builtin
// HAS_ERRNO: declare fp128 @llvm.trunc.f128(fp128) [[READNONE_INTRINSIC]]
};

// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// NO__ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
// NO__ERRNO: attributes [[PURE]] = { {{.*}}memory(read){{.*}} }

// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
// HAS_ERRNO: attributes [[PURE]] = { {{.*}}memory(read){{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }

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

18 changes: 9 additions & 9 deletions clang/test/CodeGen/math-libcalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,18 +704,18 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
};

// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }

// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }

// HAS_MAYTRAP: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
// HAS_MAYTRAP: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
// HAS_MAYTRAP: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }

// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
2 changes: 1 addition & 1 deletion clang/test/CodeGen/ms-declspecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ void noalias_caller(int *x) { noalias_callee(x); }
// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
// CHECK: attributes [[NR]] = { noreturn }
// CHECK: attributes [[NA]] = { argmemonly nounwind{{.*}} }
// CHECK: attributes [[NA]] = { nounwind memory(argmem: readwrite){{.*}} }
2 changes: 1 addition & 1 deletion clang/test/CodeGen/pragma-weak.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ void zzz(void){}
int correct_linkage;

// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
// CHECK: attributes [[RN]] = { noinline nounwind optnone readnone{{.*}} }
// CHECK: attributes [[RN]] = { noinline nounwind optnone willreturn memory(none){{.*}} }
4 changes: 2 additions & 2 deletions clang/test/CodeGen/struct-passing.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ void *ps[] = { f0, f1, f2, f3, f4, f5 };
// CHECK: declare void @f4({{.*}} byval({{.*}}) align 4)
// CHECK: declare void @f5({{.*}} byval({{.*}}) align 4)

// CHECK: attributes [[RN]] = { nounwind readnone{{.*}} }
// CHECK: attributes [[RO]] = { nounwind readonly{{.*}} }
// CHECK: attributes [[RN]] = { nounwind willreturn memory(none){{.*}} }
// CHECK: attributes [[RO]] = { nounwind willreturn memory(read){{.*}} }
8 changes: 4 additions & 4 deletions clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ int f(void) {
// CHECK: declare noundef i32 @_Z1tv() [[TF2:#[0-9]+]]

// CHECK: attributes [[TF]] = { {{.*}} }
// CHECK: attributes [[NUW_RN]] = { nounwind readnone willreturn{{.*}} }
// CHECK: attributes [[NUW_RO]] = { nounwind readonly willreturn{{.*}} }
// CHECK: attributes [[NUW_RN]] = { nounwind willreturn memory(none){{.*}} }
// CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read){{.*}} }
// CHECK: attributes [[TF2]] = { {{.*}} }
// CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone willreturn }
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn }
// CHECK: attributes [[NUW_RN_CALL]] = { nounwind willreturn memory(none) }
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind willreturn memory(read) }
2 changes: 1 addition & 1 deletion clang/test/CodeGenCXX/dynamic-cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ const B& f(A *a) {

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

// CHECK: attributes [[NUW_RO]] = { nounwind readonly }
// CHECK: attributes [[NUW_RO]] = { nounwind memory(read) }
// CHECK: attributes [[NR]] = { noreturn }
2 changes: 1 addition & 1 deletion clang/test/CodeGenCXX/threadlocal_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ int f() {
// CHECK-O1-NEXT: store i32 %[[INC]], ptr %[[J_ADDR]]
// CHECK-O1-NEXT: ret i32 %[[INC]]
//
// CHECK: attributes #[[ATTR_NUM]] = { nocallback nofree nosync nounwind readnone speculatable willreturn }
// CHECK: attributes #[[ATTR_NUM]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
2 changes: 1 addition & 1 deletion clang/test/CodeGenObjC/class-stubs.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ - (void) anotherInstanceMethod {
@end

// -- calls to objc_loadClassRef() are readnone
// CHECK: attributes [[ATTRLIST]] = { nounwind nonlazybind readnone }
// CHECK: attributes [[ATTRLIST]] = { nounwind nonlazybind memory(none) }
2 changes: 1 addition & 1 deletion clang/test/CodeGenOpenCL/builtins-amdgcn.cl
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ kernel void test_s_setreg(uint val) {

// CHECK-DAG: [[$WI_RANGE]] = !{i32 0, i32 1024}
// CHECK-DAG: [[$WS_RANGE]] = !{i16 1, i16 1025}
// CHECK-DAG: attributes #[[$NOUNWIND_READONLY:[0-9]+]] = { nofree nounwind readonly }
// CHECK-DAG: attributes #[[$NOUNWIND_READONLY:[0-9]+]] = { nofree nounwind memory(read) }
// CHECK-DAG: attributes #[[$READ_EXEC_ATTRS]] = { convergent }
// CHECK-DAG: ![[$EXEC]] = !{!"exec"}
// CHECK-DAG: ![[$EXEC_LO]] = !{!"exec_lo"}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ void test_generic_optionality(float a, float *b) {
}

// CHECK: attributes [[ATTR_CONST]] =
// CHECK-SAME: readnone
// CHECK-SAME: memory(none)
// CHECK: attributes [[ATTR_PURE]] =
// CHECK-SAME: readonly
// CHECK-SAME: memory(read)
2 changes: 1 addition & 1 deletion clang/test/OpenMP/barrier_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char **argv) {
// CLANGCG: declare i32 @__kmpc_global_thread_num(ptr)
// IRBUILDER: ; Function Attrs: nounwind
// IRBUILDER-NEXT: declare i32 @__kmpc_global_thread_num(ptr) #
// IRBUILDER_OPT: ; Function Attrs: inaccessiblememonly nofree nosync nounwind readonly
// IRBUILDER_OPT: ; Function Attrs: nofree nosync nounwind willreturn memory(inaccessiblemem: read)
// IRBUILDER_OPT-NEXT: declare i32 @__kmpc_global_thread_num(ptr nocapture nofree readonly) #

// CHECK: define {{.+}} [[TMAIN_INT]](
Expand Down
2 changes: 1 addition & 1 deletion clang/test/OpenMP/irbuilder_simd_aligned.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void simple(float *a, float *b, int *c) {
//.
// 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" }
// 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" }
// CHECK: attributes #2 = { inaccessiblememonly nocallback nofree nosync nounwind willreturn }
// CHECK: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 50}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Sema/libbuiltins-ctype-powerpc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ void test(int x) {
// CHECK: declare signext i32 @tolower(i32 noundef signext) [[NUW_RO:#[0-9]+]]
// CHECK: declare signext i32 @toupper(i32 noundef signext) [[NUW_RO:#[0-9]+]]

// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn }
// CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read){{.*}} }
// CHECK: attributes [[NUW_RO_CALL]] = { nounwind willreturn memory(read) }
4 changes: 2 additions & 2 deletions clang/test/Sema/libbuiltins-ctype-x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ void test(int x) {
// CHECK: declare i32 @tolower(i32 noundef) [[NUW_RO:#[0-9]+]]
// CHECK: declare i32 @toupper(i32 noundef) [[NUW_RO:#[0-9]+]]

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

0 comments on commit 304f1d5

Please sign in to comment.