diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-10-17 03:30:25 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-10-17 03:30:25 +0000 |
| commit | 4e319ca894be92e484ca1f9bbe44c12a7f601d4b (patch) | |
| tree | 9096fef4ef19b693d8e5f9db8fee27732ad10b9f /clang | |
| parent | ef96986a1f8f47a67937c56564524e20e3903946 (diff) | |
| download | bcm5719-llvm-4e319ca894be92e484ca1f9bbe44c12a7f601d4b.tar.gz bcm5719-llvm-4e319ca894be92e484ca1f9bbe44c12a7f601d4b.zip | |
Basic: make the nan family pure
The nan family of math routines do not rely on global state. They do
however depend on their parameter. This fits the description of pure:
Functions which have no effects except the return value and their
return value depends only on the parameters and/or global variables.
Mark the family as `readonly`.
llvm-svn: 315968
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/Builtins.def | 6 | ||||
| -rw-r--r-- | clang/test/CodeGen/libcall-declarations.c | 20 |
2 files changed, 11 insertions, 15 deletions
diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def index 1873c2e3d38..fef46da2d7e 100644 --- a/clang/include/clang/Basic/Builtins.def +++ b/clang/include/clang/Basic/Builtins.def @@ -1008,9 +1008,9 @@ LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nan, "dcC*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nanf, "fcC*", "fn", "math.h", ALL_LANGUAGES) -LIBBUILTIN(nanl, "LdcC*", "fn", "math.h", ALL_LANGUAGES) +LIBBUILTIN(nan, "dcC*", "fUn", "math.h", ALL_LANGUAGES) +LIBBUILTIN(nanf, "fcC*", "fUn", "math.h", ALL_LANGUAGES) +LIBBUILTIN(nanl, "LdcC*", "fUn", "math.h", ALL_LANGUAGES) LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES) diff --git a/clang/test/CodeGen/libcall-declarations.c b/clang/test/CodeGen/libcall-declarations.c index 83b35fe3d0d..8a93b402ab7 100644 --- a/clang/test/CodeGen/libcall-declarations.c +++ b/clang/test/CodeGen/libcall-declarations.c @@ -330,9 +330,9 @@ void *use[] = { // CHECK-NOERRNO: declare double @ldexp(double, i32) [[NUWRN]] // CHECK-NOERRNO: declare float @ldexpf(float, i32) [[NUWRN]] // CHECK-NOERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[NUWRN]] -// CHECK-NOERRNO: declare double @nan(i8*) [[NUW:#[0-9]+]] -// CHECK-NOERRNO: declare float @nanf(i8*) [[NUW]] -// CHECK-NOERRNO: declare x86_fp80 @nanl(i8*) [[NUW]] +// CHECK-NOERRNO: declare double @nan(i8*) [[NUWRO:#[0-9]+]] +// CHECK-NOERRNO: declare float @nanf(i8*) [[NUWRO]] +// CHECK-NOERRNO: declare x86_fp80 @nanl(i8*) [[NUWRO]] // CHECK-NOERRNO: declare double @pow(double, double) [[NUWRN]] // CHECK-NOERRNO: declare float @powf(float, float) [[NUWRN]] // CHECK-NOERRNO: declare x86_fp80 @powl(x86_fp80, x86_fp80) [[NUWRN]] @@ -539,9 +539,9 @@ void *use[] = { // CHECK-ERRNO: declare double @fabs(double) [[NUWRN]] // CHECK-ERRNO: declare float @fabsf(float) [[NUWRN]] // CHECK-ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[NUWRN]] -// CHECK-ERRNO: declare double @nan(i8*) [[NUW:#[0-9]+]] -// CHECK-ERRNO: declare float @nanf(i8*) [[NUW]] -// CHECK-ERRNO: declare x86_fp80 @nanl(i8*) [[NUW]] +// CHECK-ERRNO: declare double @nan(i8*) [[NUWRO:#[0-9]+]] +// CHECK-ERRNO: declare float @nanf(i8*) [[NUWRO]] +// CHECK-ERRNO: declare x86_fp80 @nanl(i8*) [[NUWRO]] // CHECK-ERRNO: declare double @ceil(double) [[NUWRN]] // CHECK-ERRNO: declare float @ceilf(float) [[NUWRN]] // CHECK-ERRNO: declare x86_fp80 @ceill(x86_fp80) [[NUWRN]] @@ -615,11 +615,7 @@ void *use[] = { // CHECK-ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[NUWRN]] // CHECK-NOERRNO: attributes [[NUWRN]] = { nounwind readnone{{.*}} } -// CHECK-NOERRNO: attributes [[NUW]] = { nounwind -// CHECK-NOERRNO-NOT: readnone -// CHECK-NOERRNO-SAME: {{.*}} } +// CHECK-NOERRNO: attributes [[NUWRO]] = { nounwind readonly{{.*}} } -// CHECK-ERRNO: attributes [[NUW]] = { nounwind -// CHECK-ERRNO-NOT: readnone -// CHECK-ERRNO-SAME: {{.*}} } // CHECK-ERRNO: attributes [[NUWRN]] = { nounwind readnone{{.*}} } +// CHECK-ERRNO: attributes [[NUWRO]] = { nounwind readonly{{.*}} } |

