diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-11-02 20:39:26 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-11-02 20:39:26 +0000 |
commit | 603490dae39300a191e0485ce192a46176267397 (patch) | |
tree | 80266299cf37a0a5ae90ef008d4f5d83d669ec55 /test/CodeGen/builtin-sqrt.c | |
parent | de0289c4685fc6f78767d6257a3a17467bcf6783 (diff) |
[CodeGen] fix const-ness of builtin equivalents of <math.h> and <complex.h> functions that might set errno
This just makes const-ness of the builtins match const-ness of their lib function siblings.
We're deferring fixing some of these that are obviously wrong to follow-up patches.
Hopefully, the bugs are visible in the new test file (added at rL317220).
As the description in Builtins.def says: "e = const, but only when -fmath-errno=0".
This is step 2 of N to fix builtins and math calls as discussed in D39204.
Differential Revision: https://reviews.llvm.org/D39481
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/builtin-sqrt.c')
-rw-r--r-- | test/CodeGen/builtin-sqrt.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/CodeGen/builtin-sqrt.c b/test/CodeGen/builtin-sqrt.c index f93c5926d5..528ad09517 100644 --- a/test/CodeGen/builtin-sqrt.c +++ b/test/CodeGen/builtin-sqrt.c @@ -1,9 +1,7 @@ // 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 -// FIXME: If a builtin is supposed to have identical semantics to its libm twin, then it -// should not be marked "constant" in Builtins.def because that means it can't set errno. -// Note that both runs have 'readnone' on the libcall here. +// FIXME: If the builtin does not set errno, it should be converted to an LLVM intrinsic. float foo(float X) { // HAS_ERRNO: call float @sqrtf(float @@ -12,7 +10,7 @@ float foo(float X) { } // HAS_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] -// HAS_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}} +// HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone // NO_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] // NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}} |