From 13185f01546a35fb5366e50b5bb95ec3a227c5ea Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 14 Oct 2021 13:35:25 +0100 Subject: [PATCH] [Transforms] eliminateDeadStores - remove unused variable. NFC. 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. --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index 543aca113e9c..8cee53f8e3ac 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -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"); @@ -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;