Fix scalarrepl to not 'miscompile' undefined code, part #2.

This fixes the store case, my previous patch just fixed the load
case.  rdar://5707076.

llvm-svn: 46932
This commit is contained in:
Chris Lattner 2008-02-10 19:05:37 +00:00
parent 3050f74a1d
commit dcddd64424
1 changed files with 1 additions and 1 deletions

View File

@ -1150,7 +1150,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
// then 'or' into place.
Value *SV = SI->getOperand(0);
const Type *AllocaType = NewAI->getType()->getElementType();
if (SV->getType() == AllocaType) {
if (SV->getType() == AllocaType && Offset == 0) {
// All is well.
} else if (const VectorType *PTy = dyn_cast<VectorType>(AllocaType)) {
Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI);