summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-01-19 08:36:56 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-01-19 08:36:56 +0000
commitade182125fc708b928ffa5dfb7be698de91dff85 (patch)
treec58519d3563507bf281a89b754417531d0340ba0 /llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
parent29b9d7cdff52326438691723a76fc89277b1a842 (diff)
downloadbcm5719-llvm-ade182125fc708b928ffa5dfb7be698de91dff85.tar.gz
bcm5719-llvm-ade182125fc708b928ffa5dfb7be698de91dff85.zip
For PR696:
Don't do floor->floorf conversion if floorf is not available. This checks the compiler's host, not its target, which is incorrect for cross-compilers Not sure that's important as we don't build many cross-compilers. llvm-svn: 25456
Diffstat (limited to 'llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
index 7da881efa55..e4239e31987 100644
--- a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -25,6 +25,7 @@
#include "llvm/Pass.h"
#include "llvm/ADT/hash_map"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Config/config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/IPO.h"
@@ -317,12 +318,14 @@ public:
return memcpy_func;
}
+#ifdef HAVE_FLOORF
Function* get_floorf() {
if (!floorf_func)
floorf_func = M->getOrInsertFunction("floorf", Type::FloatTy,
Type::FloatTy, (Type *)0);
return floorf_func;
}
+#endif
private:
/// @brief Reset our cached data for a new Module
@@ -337,7 +340,9 @@ private:
sqrt_func = 0;
strcpy_func = 0;
strlen_func = 0;
+#ifdef HAVE_FLOORF
floorf_func = 0;
+#endif
}
private:
@@ -348,7 +353,9 @@ private:
Function* sqrt_func; ///< Cached sqrt function
Function* strcpy_func; ///< Cached strcpy function
Function* strlen_func; ///< Cached strlen function
+#ifdef HAVE_FLOORF
Function* floorf_func; ///< Cached floorf function
+#endif
Module* M; ///< Cached Module
TargetData* TD; ///< Cached TargetData
};
@@ -1906,6 +1913,7 @@ public:
} FFSLLOptimizer;
+#ifdef HAVE_FLOORF
/// This LibCallOptimization will simplify calls to the "floor" library
/// function.
/// @brief Simplify the floor library function.
@@ -1937,6 +1945,7 @@ struct FloorOptimization : public LibCallOptimization {
return false; // opt failed
}
} FloorOptimizer;
+#endif
OpenPOWER on IntegriCloud