Fixed bug in DeadStoreElimination commit r144239

Size of data being pointed to wasn't always being checked so some small writes were killing big writes

Fixes <rdar://problem/10426753>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Pete Cooper 2011-11-10 20:22:08 +00:00
parent c343e3192b
commit c7e5a6a2c6

View File

@ -380,7 +380,7 @@ static OverwriteResult isOverwrite(const AliasAnalysis::Location &Later,
if (isObjectPointerWithTrustworthySize(UO2)) {
uint64_t ObjectSize =
TD.getTypeAllocSize(cast<PointerType>(UO2->getType())->getElementType());
if (ObjectSize == Later.Size)
if (ObjectSize == Later.Size && ObjectSize >= Earlier.Size)
return OverwriteComplete;
}