mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant. llvm-svn: 90545
This commit is contained in:
parent
269f4c1c24
commit
107fc93d48
@ -432,7 +432,7 @@ Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C,
|
||||
// Instead of loading constant c string, use corresponding integer value
|
||||
// directly if string length is small enough.
|
||||
std::string Str;
|
||||
if (TD && GetConstantStringInfo(CE->getOperand(0), Str) && !Str.empty()) {
|
||||
if (TD && GetConstantStringInfo(CE, Str) && !Str.empty()) {
|
||||
unsigned StrLen = Str.length();
|
||||
const Type *Ty = cast<PointerType>(CE->getType())->getElementType();
|
||||
unsigned NumBits = Ty->getPrimitiveSizeInBits();
|
||||
|
@ -101,3 +101,12 @@ entry:
|
||||
}
|
||||
|
||||
|
||||
; PR5551
|
||||
@test12g = private constant [6 x i8] c"a\00b\00\00\00"
|
||||
|
||||
define i16 @test12() {
|
||||
%a = load i16* getelementptr inbounds ([3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1)
|
||||
ret i16 %a
|
||||
; CHECK: @test12
|
||||
; CHECK: ret i16 98
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user