Skip to content

Commit

Permalink
[DSE][NFC] Clean up DeadStoreElimination from unused variables
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D106446
  • Loading branch information
yurai007 committed Aug 4, 2021
1 parent 643ce70 commit 238139b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Expand Up @@ -1786,7 +1786,6 @@ struct DSEState {
continue;

Instruction *DefI = Def->getMemoryInst();
SmallVector<const Value *, 4> Pointers;
auto DefLoc = getLocForWriteEx(DefI);
if (!DefLoc)
continue;
Expand Down Expand Up @@ -1814,8 +1813,7 @@ struct DSEState {

/// \returns true if \p Def is a no-op store, either because it
/// directly stores back a loaded value or stores zero to a calloced object.
bool storeIsNoop(MemoryDef *Def, const MemoryLocation &DefLoc,
const Value *DefUO) {
bool storeIsNoop(MemoryDef *Def, const Value *DefUO) {
StoreInst *Store = dyn_cast<StoreInst>(Def->getMemoryInst());
MemSetInst *MemSet = dyn_cast<MemSetInst>(Def->getMemoryInst());
Constant *StoredConstant = nullptr;
Expand Down Expand Up @@ -2084,7 +2082,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,

// Check if the store is a no-op.
if (!Shortend && isRemovable(SI) &&
State.storeIsNoop(KillingDef, SILoc, SILocUnd)) {
State.storeIsNoop(KillingDef, SILocUnd)) {
LLVM_DEBUG(dbgs() << "DSE: Remove No-Op Store:\n DEAD: " << *SI << '\n');
State.deleteDeadInstruction(SI);
NumRedundantStores++;
Expand Down

0 comments on commit 238139b

Please sign in to comment.