summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-26 01:20:37 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-26 01:20:37 +0000
commitdb40b5c899a94db50e63862af985a791ad0fa7b4 (patch)
tree4cdeaf9dfcaafe02334446411dbd40a47aa7ed03 /llvm/lib/Transforms
parent808457cfd6f7027a351693cf52fa86d18479c5fd (diff)
downloadbcm5719-llvm-db40b5c899a94db50e63862af985a791ad0fa7b4.tar.gz
bcm5719-llvm-db40b5c899a94db50e63862af985a791ad0fa7b4.zip
PR9561: A store with a negative offset (via GEP) could erroniously say that it
completely overlaps a previous store, thus mistakenly deleting that store. Check for this condition. llvm-svn: 128319
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 867a06ad202..d07cf0727a8 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -354,8 +354,10 @@ static bool isCompleteOverwrite(const AliasAnalysis::Location &Later,
// In this case, we see if the later store completely overlaps all bytes
// stored by the previous store.
if (Off1 < Off2 || // Earlier starts before Later.
+ Off2 < 0 || // Later is -.
Off1+Earlier.Size > Off2+Later.Size) // Earlier goes beyond Later.
return false;
+
// Otherwise, we have complete overlap.
return true;
}
OpenPOWER on IntegriCloud