Skip to content

Commit 14a49f5

Browse files
committed
[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.
1 parent f3c74b7 commit 14a49f5

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
@@ -1279,10 +1279,6 @@ struct DSEState {
12791279
if (CB->onlyAccessesInaccessibleMemory())
12801280
return false;
12811281

1282-
// NOTE: For calls, the number of stores removed could be slightly improved
1283-
// by using AA.callCapturesBefore(UseInst, DefLoc, &DT), but that showed to
1284-
// be expensive compared to the benefits in practice. For now, avoid more
1285-
// expensive analysis to limit compile-time.
12861282
return isRefSet(BatchAA.getModRefInfo(UseInst, DefLoc));
12871283
}
12881284

@@ -1793,7 +1789,7 @@ struct DSEState {
17931789
// uncommon. If it turns out to be important, we can use
17941790
// getUnderlyingObjects here instead.
17951791
const Value *UO = getUnderlyingObject(DefLoc->Ptr);
1796-
if (!UO || !isInvisibleToCallerAfterRet(UO))
1792+
if (!isInvisibleToCallerAfterRet(UO))
17971793
continue;
17981794

17991795
if (isWriteAtEndOfFunction(Def)) {
@@ -1965,9 +1961,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
19651961
unsigned PartialLimit = MemorySSAPartialStoreLimit;
19661962
// Worklist of MemoryAccesses that may be killed by KillingDef.
19671963
SetVector<MemoryAccess *> ToCheck;
1968-
1969-
if (KillingUndObj)
1970-
ToCheck.insert(KillingDef->getDefiningAccess());
1964+
ToCheck.insert(KillingDef->getDefiningAccess());
19711965

19721966
bool Shortend = false;
19731967
bool IsMemTerm = State.isMemTerminatorInst(KillingI);

0 commit comments

Comments
 (0)