aboutsummaryrefslogtreecommitdiff
path: root/lib
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
commite420449e80191051d6d1636883f2400cb0a8ace5 (patch)
treeb88de841c67f1964b5b0a441ee3ef326e9aa83a2 /lib
parent17cbaa3c82f5982c7ee3089f95529af1afd407d3 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 867a06ad20..d07cf0727a 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/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;
}