Don't sign extend the char when expanding char -> int during

load(bitcast(char[4] to i32*)) evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65246 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2009-02-21 20:50:42 +00:00
parent 92acef0e94
commit 2ec0dbf961
2 changed files with 14 additions and 2 deletions

View File

@@ -11028,12 +11028,12 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
APInt SingleChar(numBits, 0);
if (TD->isLittleEndian()) {
for (signed i = len-1; i >= 0; i--) {
SingleChar = (uint64_t) Str[i];
SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
StrVal = (StrVal << 8) | SingleChar;
}
} else {
for (unsigned i = 0; i < len; i++) {
SingleChar = (uint64_t) Str[i];
SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
StrVal = (StrVal << 8) | SingleChar;
}
// Append NULL at the end.