Fix PR491 and testcase Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll
authorChris Lattner <sabre@nondot.org>
Wed, 29 Dec 2004 04:36:02 +0000 (04:36 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 29 Dec 2004 04:36:02 +0000 (04:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19180 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/DeadStoreElimination.cpp

index 27a0b0a881f39074ff02c68b337126da449dc21f..e29bad53c19cb9abc8f70421e58396e760c9382b 100644 (file)
@@ -111,7 +111,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
 
     if (AliasSet *AS = KillLocs.getAliasSetForPointerIfExists(Ptr, ValSize))
       for (AliasSet::iterator ASI = AS->begin(), E = AS->end(); ASI != E; ++ASI)
-        if (AA.alias(ASI.getPointer(), ASI.getSize(), Ptr, ValSize)
+        if (ASI.getSize() >= ValSize &&  // Overwriting all of this store.
+            AA.alias(ASI.getPointer(), ASI.getSize(), Ptr, ValSize)
                == AliasAnalysis::MustAlias) {
           // If we found a must alias in the killed set, then this store really
           // is dead.  Remember that the various operands of the store now have