From da16d8c00bb52e37967dc7a18a4bd39f16f10650 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 29 Dec 2004 04:36:02 +0000 Subject: [PATCH] Fix PR491 and testcase Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19180 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/DeadStoreElimination.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 27a0b0a881f..e29bad53c19 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -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