mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 10:26:06 +00:00

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
16 lines
684 B
C
16 lines
684 B
C
// RUN: %clang_cc1 -fmath-errno -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=HAS_ERRNO
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=NO_ERRNO
|
|
|
|
float foo(float X) {
|
|
// HAS_ERRNO: call float @sqrtf(float
|
|
// NO_ERRNO: call float @llvm.sqrt.f32(float
|
|
return __builtin_sqrtf(X);
|
|
}
|
|
|
|
// HAS_ERRNO: declare float @sqrtf(float noundef) [[ATTR:#[0-9]+]]
|
|
// 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 speculatable willreturn memory(none) }
|
|
|