Skip to content

Commit d8b078d

Browse files
[Transforms] Use llvm::append_range (NFC) (#133607)
1 parent ad1ba15 commit d8b078d

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ static void getRelevantOperands(Instruction *I, SmallVectorImpl<Value *> &Ops) {
7777
Ops.push_back(I->getOperand(2));
7878
break;
7979
case Instruction::PHI:
80-
for (Value *V : cast<PHINode>(I)->incoming_values())
81-
Ops.push_back(V);
80+
llvm::append_range(Ops, cast<PHINode>(I)->incoming_values());
8281
break;
8382
default:
8483
llvm_unreachable("Unreachable!");

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,7 @@ bool SampleProfileLoader::tryInlineCandidate(
12671267
// Now populate the list of newly exposed call sites.
12681268
if (InlinedCallSites) {
12691269
InlinedCallSites->clear();
1270-
for (auto &I : IFI.InlinedCallSites)
1271-
InlinedCallSites->push_back(I);
1270+
llvm::append_range(*InlinedCallSites, IFI.InlinedCallSites);
12721271
}
12731272

12741273
if (FunctionSamples::ProfileIsCS)

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ class DFAJumpThreading {
164164
unfold(&DTU, LI, SIToUnfold, &NewSIsToUnfold, &NewBBs);
165165

166166
// Put newly discovered select instructions into the work list.
167-
for (const SelectInstToUnfold &NewSIToUnfold : NewSIsToUnfold)
168-
Stack.push_back(NewSIToUnfold);
167+
llvm::append_range(Stack, NewSIsToUnfold);
169168
}
170169
}
171170

llvm/lib/Transforms/Scalar/StructurizeCFG.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,12 +737,10 @@ void StructurizeCFG::findUndefBlocks(
737737
if (!VisitedBlock.insert(Current).second)
738738
continue;
739739

740-
if (FlowSet.contains(Current)) {
741-
for (auto P : predecessors(Current))
742-
Stack.push_back(P);
743-
} else if (!Incomings.contains(Current)) {
740+
if (FlowSet.contains(Current))
741+
llvm::append_range(Stack, predecessors(Current));
742+
else if (!Incomings.contains(Current))
744743
UndefBlks.push_back(Current);
745-
}
746744
}
747745
}
748746

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6929,10 +6929,9 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
69296929
DeadInterleavePointerOps.append(Op->op_begin(), Op->op_end());
69306930
}
69316931

6932-
for (const auto &[_, Ops] : DeadInvariantStoreOps) {
6933-
for (Value *Op : ArrayRef(Ops).drop_back())
6934-
DeadOps.push_back(Op);
6935-
}
6932+
for (const auto &[_, Ops] : DeadInvariantStoreOps)
6933+
llvm::append_range(DeadOps, ArrayRef(Ops).drop_back());
6934+
69366935
// Mark ops that would be trivially dead and are only used by ignored
69376936
// instructions as free.
69386937
BasicBlock *Header = TheLoop->getHeader();

0 commit comments

Comments
 (0)