[llvm] 13185f0 - [Transforms] eliminateDeadStores - remove unused variable. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 14 10:12:07 PDT 2021
Author: Simon Pilgrim
Date: 2021-10-14T18:10:03+01:00
New Revision: 13185f01546a35fb5366e50b5bb95ec3a227c5ea
URL: https://github.com/llvm/llvm-project/commit/13185f01546a35fb5366e50b5bb95ec3a227c5ea
DIFF: https://github.com/llvm/llvm-project/commit/13185f01546a35fb5366e50b5bb95ec3a227c5ea.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 543aca113e9c2..8cee53f8e3acb 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;
More information about the llvm-commits
mailing list