aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/TargetLibraryInfo.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-01-26 23:51:06 +0000
committerJustin Lebar <jlebar@google.com>2016-01-26 23:51:06 +0000
commit511328817d259076e549de381c72c19c53f7a6f6 (patch)
tree00c91a4834da515f2335c3404f3d8fed22de06a6 /llvm/lib/Analysis/TargetLibraryInfo.cpp
parent87c85b7e23f3d87b0c8a8826e3ebc867fca7e7ae (diff)
downloadllvm-511328817d259076e549de381c72c19c53f7a6f6.zip
llvm-511328817d259076e549de381c72c19c53f7a6f6.tar.gz
llvm-511328817d259076e549de381c72c19c53f7a6f6.tar.bz2
Disable all standard lib functions for NVVM.
Summary: NVVM doesn't have a standard library, as currently implemented, so this just isn't going to work. I'd like to revisit this, since it's hiding opportunities for optimization, but correctness comes first. Thank you to hfinkel for pointing me in the right direction here. Reviewers: tra Subscribers: echristo, jhen, llvm-commits, hfinkel Differential Revision: http://reviews.llvm.org/D16604 llvm-svn: 258884
Diffstat (limited to 'llvm/lib/Analysis/TargetLibraryInfo.cpp')
-rw-r--r--llvm/lib/Analysis/TargetLibraryInfo.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 61b05ab..3bd54c47 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -385,6 +385,20 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
TLI.setUnavailable(LibFunc::tmpfile64);
}
+ // As currently implemented in clang, NVPTX code has no standard library to
+ // speak of. Headers provide a standard-ish library implementation, but many
+ // of the signatures are wrong -- for example, many libm functions are not
+ // extern "C".
+ //
+ // libdevice, an IR library provided by nvidia, is linked in by the front-end,
+ // but only used functions are provided to llvm. Moreover, most of the
+ // functions in libdevice don't map precisely to standard library functions.
+ //
+ // FIXME: Having no standard library prevents e.g. many fastmath
+ // optimizations, so this situation should be fixed.
+ if (T.isNVPTX())
+ TLI.disableAllFunctions();
+
TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary);
}