mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
[SimplifyLibCalls] Fix negative shifts being produced by the memchr -> bitfield transform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232903 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user