diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-06-15 22:17:38 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-06-15 22:17:38 +0000 |
commit | 72a793c5b1b0293eee0908e0264a7f7b814025b7 (patch) | |
tree | b90943854151f24580aef85300c73f551bc7b914 /llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | |
parent | 595098f9f2d1987f84f9b88adec57eae9d245d92 (diff) | |
download | bcm5719-llvm-72a793c5b1b0293eee0908e0264a7f7b814025b7.tar.gz bcm5719-llvm-72a793c5b1b0293eee0908e0264a7f7b814025b7.zip |
[DSE] Hoist a redundant check to simplify logic. NFC.
llvm-svn: 272849
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index e0f6099dab5..4edb91d34c4 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -289,29 +289,22 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later, const DataLayout &DL, const TargetLibraryInfo &TLI, int64_t &EarlierOff, int64_t &LaterOff) { + // If we don't know the sizes of either access, then we can't do a comparison. + if (Later.Size == MemoryLocation::UnknownSize || + Earlier.Size == MemoryLocation::UnknownSize) + return OverwriteUnknown; + const Value *P1 = Earlier.Ptr->stripPointerCasts(); const Value *P2 = Later.Ptr->stripPointerCasts(); // If the start pointers are the same, we just have to compare sizes to see if // the later store was larger than the earlier store. if (P1 == P2) { - // If we don't know the sizes of either access, then we can't do a - // comparison. - if (Later.Size == MemoryLocation::UnknownSize || - Earlier.Size == MemoryLocation::UnknownSize) - return OverwriteUnknown; - // Make sure that the Later size is >= the Earlier size. if (Later.Size >= Earlier.Size) return OverwriteComplete; } - // Otherwise, we have to have size information, and the later store has to be - // larger than the earlier one. - if (Later.Size == MemoryLocation::UnknownSize || - Earlier.Size == MemoryLocation::UnknownSize) - return OverwriteUnknown; - // Check to see if the later store is to the entire object (either a global, // an alloca, or a byval/inalloca argument). If so, then it clearly // overwrites any other store to the same object. |