[llvm-commits] [llvm] r65246 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-02-21-LoadCST.ll
Nick Lewycky
nicholas at mxc.ca
Sat Feb 21 12:50:53 PST 2009
Author: nicholas
Date: Sat Feb 21 14:50:42 2009
New Revision: 65246
URL: http://llvm.org/viewvc/llvm-project?rev=65246&view=rev
Log:
Don't sign extend the char when expanding char -> int during
load(bitcast(char[4] to i32*)) evaluation.
Added:
llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65246&r1=65245&r2=65246&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Feb 21 14:50:42 2009
@@ -11028,12 +11028,12 @@
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.
Added: llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll?rev=65246&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll Sat Feb 21 14:50:42 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 3679669}
+; PR3595
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+ at .str1 = internal constant [4 x i8] c"\B5%8\00"
+
+define i32 @test() {
+ %rhsv = load i32* bitcast ([4 x i8]* @.str1 to i32*), align 1
+ ret i32 %rhsv
+}
More information about the llvm-commits
mailing list