Skip to content

Commit

Permalink
[Transforms] eliminateDeadStores - remove unused variable. NFC.
Browse files Browse the repository at this point in the history
The initial MemoryAccess *Current assignment is never used, and all other uses are initialized/used within the worklist loop (and not across multiple iterations) - so move the variable internal to the loop.

Fixes scan-build unused assignment warning.
  • Loading branch information
RKSimon committed Oct 14, 2021
1 parent b6c218d commit 13185f0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Expand Up @@ -1972,8 +1972,6 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
MemoryLocation KillingLoc = *MaybeKillingLoc;
assert(KillingLoc.Ptr && "KillingLoc should not be null");
const Value *KillingUndObj = getUnderlyingObject(KillingLoc.Ptr);

MemoryAccess *Current = KillingDef;
LLVM_DEBUG(dbgs() << "Trying to eliminate MemoryDefs killed by "
<< *KillingDef << " (" << *KillingI << ")\n");

Expand All @@ -1988,7 +1986,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
bool IsMemTerm = State.isMemTerminatorInst(KillingI);
// Check if MemoryAccesses in the worklist are killed by KillingDef.
for (unsigned I = 0; I < ToCheck.size(); I++) {
Current = ToCheck[I];
MemoryAccess *Current = ToCheck[I];
if (State.SkipStores.count(Current))
continue;

Expand Down

0 comments on commit 13185f0

Please sign in to comment.