summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-21 22:04:26 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-21 22:04:26 +0000
commitd6aa0ec737785d9b14f9dd9bb6d101892155f8c2 (patch)
treea51f151812a3a7eb4dd0e308edcc095a45d4f921 /llvm/lib/Transforms
parent7857d723f11a3a5c732c2e08d332ebca13e075ba (diff)
downloadbcm5719-llvm-d6aa0ec737785d9b14f9dd9bb6d101892155f8c2.tar.gz
bcm5719-llvm-d6aa0ec737785d9b14f9dd9bb6d101892155f8c2.zip
[SimplifyLibCalls] Fix negative shifts being produced by the memchr -> bitfield transform.
llvm-svn: 232903
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index f6cc431656b..5867d65e7e4 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -782,7 +782,9 @@ Value *LibCallSimplifier::optimizeMemChr(CallInst *CI, IRBuilder<> &B) {
// memchr("\r\n", C, 2) != nullptr -> (C & ((1 << '\r') | (1 << '\n'))) != 0
// after bounds check.
if (!CharC && !Str.empty() && isOnlyUsedInZeroEqualityComparison(CI)) {
- unsigned char Max = *std::max_element(Str.begin(), Str.end());
+ unsigned char Max =
+ *std::max_element(reinterpret_cast<const unsigned char *>(Str.begin()),
+ reinterpret_cast<const unsigned char *>(Str.end()));
// Make sure the bit field we're about to create fits in a register on the
// target.
OpenPOWER on IntegriCloud