Skip to content

Commit

Permalink
[Transforms] Fixes -Wrange-loop-analysis warnings
Browse files Browse the repository at this point in the history
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71810
  • Loading branch information
mordante committed Dec 22, 2019
1 parent b6d9e97 commit 098d334
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
Expand Up @@ -842,7 +842,7 @@ bool DevirtModule::tryFindVirtualCallTargets(
bool DevirtIndex::tryFindVirtualCallTargets(
std::vector<ValueInfo> &TargetsForSlot, const TypeIdCompatibleVtableInfo TIdInfo,
uint64_t ByteOffset) {
for (const TypeIdOffsetVtableInfo P : TIdInfo) {
for (const TypeIdOffsetVtableInfo &P : TIdInfo) {
// Ensure that we have at most one external linkage vtable initializer.
assert(P.VTableVI.getSummaryList().size() == 1 ||
llvm::count_if(
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
Expand Up @@ -489,7 +489,7 @@ class LoadEliminationForLoop {
// Filter the candidates further.
SmallVector<StoreToLoadForwardingCandidate, 4> Candidates;
unsigned NumForwarding = 0;
for (const StoreToLoadForwardingCandidate Cand : StoreToLoadDependences) {
for (const StoreToLoadForwardingCandidate &Cand : StoreToLoadDependences) {
LLVM_DEBUG(dbgs() << "Candidate " << Cand);

// Make sure that the stored values is available everywhere in the loop in
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/SCCP.cpp
Expand Up @@ -2197,7 +2197,7 @@ bool llvm::runIPSCCP(
findReturnsToZap(*F, ReturnsToZap, Solver);
}

for (const auto &F : Solver.getMRVFunctionsTracked()) {
for (auto F : Solver.getMRVFunctionsTracked()) {
assert(F->getReturnType()->isStructTy() &&
"The return type should be a struct");
StructType *STy = cast<StructType>(F->getReturnType());
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Utils/InlineFunction.cpp
Expand Up @@ -1473,7 +1473,7 @@ static void updateCallerBFI(BasicBlock *CallSiteBlock,
BlockFrequencyInfo *CalleeBFI,
const BasicBlock &CalleeEntryBlock) {
SmallPtrSet<BasicBlock *, 16> ClonedBBs;
for (auto const &Entry : VMap) {
for (auto Entry : VMap) {
if (!isa<BasicBlock>(Entry.first) || !Entry.second)
continue;
auto *OrigBB = cast<BasicBlock>(Entry.first);
Expand Down Expand Up @@ -1531,7 +1531,7 @@ void llvm::updateProfileCallee(
// During inlining ?
if (VMap) {
uint64_t cloneEntryCount = priorEntryCount - newEntryCount;
for (auto const &Entry : *VMap)
for (auto Entry : *VMap)
if (isa<CallInst>(Entry.first))
if (auto *CI = dyn_cast_or_null<CallInst>(Entry.second))
CI->updateProfWeight(cloneEntryCount, priorEntryCount);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
Expand Up @@ -584,7 +584,7 @@ static void cloneLoopBlocks(

// LastValueMap is updated with the values for the current loop
// which are used the next time this function is called.
for (const auto &KV : VMap)
for (auto KV : VMap)
LVMap[KV.first] = KV.second;
}

Expand Down

0 comments on commit 098d334

Please sign in to comment.