summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/DeadStoreElimination.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-30 21:37:19 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-30 21:37:19 +0000
commit31d244ead52171632cc4649623b426dbea27040a (patch)
tree6c74281dac484b04c931ddd355f895457781c4f9 /lib/Transforms/Scalar/DeadStoreElimination.cpp
parent81bd78b89779704aeb762f51c6c19b06d542b6d6 (diff)
downloadllvm-31d244ead52171632cc4649623b426dbea27040a.tar.gz
llvm-31d244ead52171632cc4649623b426dbea27040a.tar.bz2
llvm-31d244ead52171632cc4649623b426dbea27040a.tar.xz
* The DSE code that tested for overlapping needed to take into account the fact
that one of the numbers is signed while the other is unsigned. This could lead to a wrong result when the signed was promoted to an unsigned int. * Add the data layout line to the testcase so that it will test the appropriate thing. Patch by David Terei! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index f473cf5ca5..9f36a38691 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -361,8 +361,10 @@ static bool isCompleteOverwrite(const AliasAnalysis::Location &Later,
//
// |--earlier--|
// |----- later ------|
+ //
+ // We have to be careful here as *Off is signed while *.Size is unsigned.
if (EarlierOff >= LaterOff &&
- EarlierOff + Earlier.Size <= LaterOff + Later.Size)
+ uint64_t(EarlierOff - LaterOff) + Earlier.Size <= Later.Size)
return true;
// Otherwise, they don't completely overlap.