1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll

llvm-svn: 31151
This commit is contained in:
Chris Lattner 2006-10-24 06:26:32 +00:00
parent bca9b5f4bc
commit 0cf64c9469

View File

@ -611,11 +611,16 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt),
"tmp", LI);
} else {
assert(NV->getType()->isInteger() && "Unknown promotion!");
if (Offset && Offset < TD.getTypeSize(NV->getType())*8)
NV = new ShiftInst(Instruction::Shr, NV,
ConstantInt::get(Type::UByteTy, Offset),
LI->getName(), LI);
if (Offset) {
assert(NV->getType()->isInteger() && "Unknown promotion!");
if (Offset < TD.getTypeSize(NV->getType())*8)
NV = new ShiftInst(Instruction::Shr, NV,
ConstantInt::get(Type::UByteTy, Offset),
LI->getName(), LI);
} else {
assert((NV->getType()->isInteger() ||
isa<PointerType>(NV->getType())) && "Unknown promotion!");
}
NV = new CastInst(NV, LI->getType(), LI->getName(), LI);
}
}