summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/TargetLibraryInfo.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2016-01-03 19:43:40 +0000
committerCraig Topper <craig.topper@gmail.com>2016-01-03 19:43:40 +0000
commite30b8ca149076601ee593d93a35e39f7e7e219eb (patch)
treea6273f17560d62d30d1871600620232b43cfbdb6 /llvm/lib/Analysis/TargetLibraryInfo.cpp
parent1f26d5b1e0a3ff4b1adfe5fc81acaecbc5e4a5c0 (diff)
downloadbcm5719-llvm-e30b8ca149076601ee593d93a35e39f7e7e219eb.tar.gz
bcm5719-llvm-e30b8ca149076601ee593d93a35e39f7e7e219eb.zip
Use std::is_sorted and std::none_of instead of manual loops. NFC
llvm-svn: 256719
Diffstat (limited to 'llvm/lib/Analysis/TargetLibraryInfo.cpp')
-rw-r--r--llvm/lib/Analysis/TargetLibraryInfo.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index e00f4aed07f..ce388192562 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -52,14 +52,13 @@ static bool hasSinCosPiStret(const Triple &T) {
/// specified target triple. This should be carefully written so that a missing
/// target triple gets a sane set of defaults.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
- const char *const *StandardNames) {
-#ifndef NDEBUG
+ ArrayRef<const char *> StandardNames) {
// Verify that the StandardNames array is in alphabetical order.
- for (unsigned F = 1; F < LibFunc::NumLibFuncs; ++F) {
- if (strcmp(StandardNames[F-1], StandardNames[F]) >= 0)
- llvm_unreachable("TargetLibraryInfoImpl function names must be sorted");
- }
-#endif // !NDEBUG
+ assert(std::is_sorted(StandardNames.begin(), StandardNames.end(),
+ [](const char *LHS, const char *RHS) {
+ return strcmp(LHS, RHS) < 0;
+ }) &&
+ "TargetLibraryInfoImpl function names must be sorted");
if (T.getArch() == Triple::r600 ||
T.getArch() == Triple::amdgcn) {
OpenPOWER on IntegriCloud