[llvm] r258884 - Disable all standard lib functions for NVVM.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 15:51:07 PST 2016


Author: jlebar
Date: Tue Jan 26 17:51:06 2016
New Revision: 258884

URL: http://llvm.org/viewvc/llvm-project?rev=258884&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp

Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=258884&r1=258883&r2=258884&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Tue Jan 26 17:51:06 2016
@@ -385,6 +385,20 @@ static void initialize(TargetLibraryInfo
     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);
 }
 




More information about the llvm-commits mailing list