1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Fix Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll, a crash on undefined

behavior in 126.gcc on big-endian systems.

llvm-svn: 24708
This commit is contained in:
Chris Lattner 2005-12-14 17:23:59 +00:00
parent d4d067561f
commit 76b2303521

View File

@ -539,7 +539,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
if (LoadInst *LI = dyn_cast<LoadInst>(User)) {
// The load is a bit extract from NewAI shifted right by Offset bits.
Value *NV = new LoadInst(NewAI, LI->getName(), LI);
if (Offset)
if (Offset && Offset < NV->getType()->getPrimitiveSizeInBits())
NV = new ShiftInst(Instruction::Shr, NV,
ConstantUInt::get(Type::UByteTy, Offset),
LI->getName(), LI);
@ -563,7 +563,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
SV = new CastInst(SV, SV->getType()->getUnsignedVersion(),
SV->getName(), SI);
SV = new CastInst(SV, Old->getType(), SV->getName(), SI);
if (Offset)
if (Offset && Offset < SV->getType()->getPrimitiveSizeInBits())
SV = new ShiftInst(Instruction::Shl, SV,
ConstantUInt::get(Type::UByteTy, Offset),
SV->getName()+".adj", SI);