[llvm] r272849 - [DSE] Hoist a redundant check to simplify logic. NFC.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 15:17:38 PDT 2016
Author: mcrosier
Date: Wed Jun 15 17:17:38 2016
New Revision: 272849
URL: http://llvm.org/viewvc/llvm-project?rev=272849&view=rev
Log:
[DSE] Hoist a redundant check to simplify logic. NFC.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=272849&r1=272848&r2=272849&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Jun 15 17:17:38 2016
@@ -289,29 +289,22 @@ static OverwriteResult isOverwrite(const
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.
More information about the llvm-commits
mailing list