Skip to content

Commit dd8917a

Browse files
nikicfhahn
authored andcommitted
[DSE] Don't check getUnderlyingObject() return value (NFC)
getUnderlyingObject() never returns null. It will simply return something that is not the "root" underlying object. Also drop a stale comment. (cherry-picked from 14a49f5)
1 parent 90c779a commit dd8917a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,10 +1268,6 @@ struct DSEState {
12681268
if (CB->onlyAccessesInaccessibleMemory())
12691269
return false;
12701270

1271-
// NOTE: For calls, the number of stores removed could be slightly improved
1272-
// by using AA.callCapturesBefore(UseInst, DefLoc, &DT), but that showed to
1273-
// be expensive compared to the benefits in practice. For now, avoid more
1274-
// expensive analysis to limit compile-time.
12751271
return isRefSet(BatchAA.getModRefInfo(UseInst, DefLoc));
12761272
}
12771273

@@ -1787,7 +1783,7 @@ struct DSEState {
17871783
// uncommon. If it turns out to be important, we can use
17881784
// getUnderlyingObjects here instead.
17891785
const Value *UO = getUnderlyingObject(DefLoc->Ptr);
1790-
if (!UO || !isInvisibleToCallerAfterRet(UO))
1786+
if (!isInvisibleToCallerAfterRet(UO))
17911787
continue;
17921788

17931789
if (isWriteAtEndOfFunction(Def)) {
@@ -1916,9 +1912,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
19161912
unsigned PartialLimit = MemorySSAPartialStoreLimit;
19171913
// Worklist of MemoryAccesses that may be killed by KillingDef.
19181914
SetVector<MemoryAccess *> ToCheck;
1919-
1920-
if (SILocUnd)
1921-
ToCheck.insert(KillingDef->getDefiningAccess());
1915+
ToCheck.insert(KillingDef->getDefiningAccess());
19221916

19231917
bool Shortend = false;
19241918
bool IsMemTerm = State.isMemTerminatorInst(SI);

0 commit comments

Comments
 (0)