[NVPTX] Infer __nvvm_reflect as nounwind, readnone
This patch simply mirrors the attributes we give to @llvm.nvvm.reflect
to the __nvvm_reflect libdevice call. This shaves about 30% of the code
in libdevice away because of CSE opportunities. It's also helps us
figure out that libdevice implementations of transcendental functions
don't have side-effects.
llvm-svn: 265060
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 3bd54c4..ab667ab 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -396,8 +396,12 @@
//
// FIXME: Having no standard library prevents e.g. many fastmath
// optimizations, so this situation should be fixed.
- if (T.isNVPTX())
+ if (T.isNVPTX()) {
TLI.disableAllFunctions();
+ TLI.setAvailable(LibFunc::nvvm_reflect);
+ } else {
+ TLI.setUnavailable(LibFunc::nvvm_reflect);
+ }
TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary);
}