Skip to content

Commit 8f5c3de

Browse files
[Analysis] Use llvm::append_range (NFC) (#133602)
1 parent 0c7be93 commit 8f5c3de

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ void IRInstructionData::initializeInstruction() {
7878
// We capture the incoming BasicBlocks as values as well as the incoming
7979
// Values in order to check for structural similarity.
8080
if (PHINode *PN = dyn_cast<PHINode>(Inst))
81-
for (BasicBlock *BB : PN->blocks())
82-
OperVals.push_back(BB);
81+
llvm::append_range(OperVals, PN->blocks());
8382
}
8483

8584
IRInstructionData::IRInstructionData(IRInstructionDataList &IDList)

llvm/lib/Analysis/IVDescriptors.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,11 +1296,8 @@ InductionDescriptor::InductionDescriptor(Value *Start, InductionKind K,
12961296
InductionBinOp->getOpcode() == Instruction::FSub))) &&
12971297
"Binary opcode should be specified for FP induction");
12981298

1299-
if (Casts) {
1300-
for (auto &Inst : *Casts) {
1301-
RedundantCasts.push_back(Inst);
1302-
}
1303-
}
1299+
if (Casts)
1300+
llvm::append_range(RedundantCasts, *Casts);
13041301
}
13051302

13061303
ConstantInt *InductionDescriptor::getConstIntStepValue() const {

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,7 @@ static void visitPointers(Value *StartPtr, const Loop &InnermostLoop,
913913
// value.
914914
if (PN && InnermostLoop.contains(PN->getParent()) &&
915915
PN->getParent() != InnermostLoop.getHeader()) {
916-
for (const Use &Inc : PN->incoming_values())
917-
WorkList.push_back(Inc);
916+
llvm::append_range(WorkList, PN->incoming_values());
918917
} else
919918
AddPointer(Ptr);
920919
}

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,8 +4221,7 @@ bool ScalarEvolution::canReuseInstruction(
42214221
if (I->hasPoisonGeneratingAnnotations())
42224222
DropPoisonGeneratingInsts.push_back(I);
42234223

4224-
for (Value *Op : I->operands())
4225-
Worklist.push_back(Op);
4224+
llvm::append_range(Worklist, I->operands());
42264225
}
42274226
return true;
42284227
}
@@ -7622,8 +7621,7 @@ ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) {
76227621
case Instruction::GetElementPtr:
76237622
assert(cast<GEPOperator>(U)->getSourceElementType()->isSized() &&
76247623
"GEP source element type must be sized");
7625-
for (Value *Index : U->operands())
7626-
Ops.push_back(Index);
7624+
llvm::append_range(Ops, U->operands());
76277625
return nullptr;
76287626

76297627
case Instruction::IntToPtr:
@@ -7656,8 +7654,7 @@ ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) {
76567654
if (CanSimplifyToUnknown())
76577655
return getUnknown(U);
76587656

7659-
for (Value *Inc : U->operands())
7660-
Ops.push_back(Inc);
7657+
llvm::append_range(Ops, U->operands());
76617658
return nullptr;
76627659
break;
76637660
}

0 commit comments

Comments
 (0)