The frexp, modf, and remquo builtins are not 'const'.

These functions return a second value by writing to a pointer argument,
so they cannot be marked 'readnone' which implies that they don't access
memory.

<rdar://problem/10070234>

llvm-svn: 139319
This commit is contained in:
Jakob Stoklund Olesen 2011-09-08 21:18:03 +00:00
parent 51920a6191
commit ed2a360fd1
2 changed files with 50 additions and 9 deletions

View File

@ -97,9 +97,9 @@ BUILTIN(__builtin_fabsl, "LdLd", "ncF")
BUILTIN(__builtin_fmod , "ddd" , "Fnc")
BUILTIN(__builtin_fmodf, "fff" , "Fnc")
BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc")
BUILTIN(__builtin_frexp , "ddi*" , "Fnc")
BUILTIN(__builtin_frexpf, "ffi*" , "Fnc")
BUILTIN(__builtin_frexpl, "LdLdi*", "Fnc")
BUILTIN(__builtin_frexp , "ddi*" , "Fn")
BUILTIN(__builtin_frexpf, "ffi*" , "Fn")
BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
BUILTIN(__builtin_huge_val, "d", "nc")
BUILTIN(__builtin_huge_valf, "f", "nc")
BUILTIN(__builtin_huge_vall, "Ld", "nc")
@ -109,9 +109,9 @@ BUILTIN(__builtin_infl , "Ld" , "nc")
BUILTIN(__builtin_ldexp , "ddi" , "Fnc")
BUILTIN(__builtin_ldexpf, "ffi" , "Fnc")
BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc")
BUILTIN(__builtin_modf , "ddd*" , "Fnc")
BUILTIN(__builtin_modff, "fff*" , "Fnc")
BUILTIN(__builtin_modfl, "LdLdLd*", "Fnc")
BUILTIN(__builtin_modf , "ddd*" , "Fn")
BUILTIN(__builtin_modff, "fff*" , "Fn")
BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
BUILTIN(__builtin_nan, "dcC*" , "ncF")
BUILTIN(__builtin_nanf, "fcC*" , "ncF")
BUILTIN(__builtin_nanl, "LdcC*", "ncF")
@ -234,9 +234,9 @@ BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc")
BUILTIN(__builtin_remainder , "ddd", "Fnc")
BUILTIN(__builtin_remainderf, "fff", "Fnc")
BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc")
BUILTIN(__builtin_remquo , "dddi*", "Fnc")
BUILTIN(__builtin_remquof, "fffi*", "Fnc")
BUILTIN(__builtin_remquol, "LdLdLdi*", "Fnc")
BUILTIN(__builtin_remquo , "dddi*", "Fn")
BUILTIN(__builtin_remquof, "fffi*", "Fn")
BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
BUILTIN(__builtin_rint , "dd", "Fnc")
BUILTIN(__builtin_rintf, "ff", "Fnc")
BUILTIN(__builtin_rintl, "LdLd", "Fnc")

View File

@ -15,3 +15,44 @@ void f1() {
char* f2(char* a, char* b) {
return __builtin_strstr(a, b);
}
// frexp is NOT readnone. It writes to its pointer argument.
// <rdar://problem/10070234>
//
// CHECK: f3
// CHECK: call double @frexp(double %
// CHECK-NOT: readnone
// CHECK: call float @frexpf(float %
// CHECK-NOT: readnone
// CHECK: call double @frexpl(double %
// CHECK-NOT: readnone
//
// Same thing for modf and friends.
//
// CHECK: call double @modf(double %
// CHECK-NOT: readnone
// CHECK: call float @modff(float %
// CHECK-NOT: readnone
// CHECK: call double @modfl(double %
// CHECK-NOT: readnone
//
// CHECK: call double @remquo(double %
// CHECK-NOT: readnone
// CHECK: call float @remquof(float %
// CHECK-NOT: readnone
// CHECK: call double @remquol(double %
// CHECK-NOT: readnone
// CHECK: ret
int f3(double x) {
int e;
__builtin_frexp(x, &e);
__builtin_frexpf(x, &e);
__builtin_frexpl(x, &e);
__builtin_modf(x, &e);
__builtin_modff(x, &e);
__builtin_modfl(x, &e);
__builtin_remquo(x, x, &e);
__builtin_remquof(x, x, &e);
__builtin_remquol(x, x, &e);
return e;
}