[llvm] d8b078d - [Transforms] Use llvm::append_range (NFC) (#133607)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 29 18:57:53 PDT 2025
Author: Kazu Hirata
Date: 2025-03-29T18:57:50-07:00
New Revision: d8b078d5509d84da987c18cb357aac867051881c
URL: https://github.com/llvm/llvm-project/commit/d8b078d5509d84da987c18cb357aac867051881c
DIFF: https://github.com/llvm/llvm-project/commit/d8b078d5509d84da987c18cb357aac867051881c.diff
LOG: [Transforms] Use llvm::append_range (NFC) (#133607)
Added:
Modified:
llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
index 4d9050be5c553..1cef43b8ee5a4 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
@@ -77,8 +77,7 @@ static void getRelevantOperands(Instruction *I, SmallVectorImpl<Value *> &Ops) {
Ops.push_back(I->getOperand(2));
break;
case Instruction::PHI:
- for (Value *V : cast<PHINode>(I)->incoming_values())
- Ops.push_back(V);
+ llvm::append_range(Ops, cast<PHINode>(I)->incoming_values());
break;
default:
llvm_unreachable("Unreachable!");
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 8b1140e8eabcd..d89da7621990a 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1267,8 +1267,7 @@ bool SampleProfileLoader::tryInlineCandidate(
// Now populate the list of newly exposed call sites.
if (InlinedCallSites) {
InlinedCallSites->clear();
- for (auto &I : IFI.InlinedCallSites)
- InlinedCallSites->push_back(I);
+ llvm::append_range(*InlinedCallSites, IFI.InlinedCallSites);
}
if (FunctionSamples::ProfileIsCS)
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index c99238a2d5ff4..82434680b8f23 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -164,8 +164,7 @@ class DFAJumpThreading {
unfold(&DTU, LI, SIToUnfold, &NewSIsToUnfold, &NewBBs);
// Put newly discovered select instructions into the work list.
- for (const SelectInstToUnfold &NewSIToUnfold : NewSIsToUnfold)
- Stack.push_back(NewSIToUnfold);
+ llvm::append_range(Stack, NewSIsToUnfold);
}
}
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index caba873408335..00c4fcc76e791 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -737,12 +737,10 @@ void StructurizeCFG::findUndefBlocks(
if (!VisitedBlock.insert(Current).second)
continue;
- if (FlowSet.contains(Current)) {
- for (auto P : predecessors(Current))
- Stack.push_back(P);
- } else if (!Incomings.contains(Current)) {
+ if (FlowSet.contains(Current))
+ llvm::append_range(Stack, predecessors(Current));
+ else if (!Incomings.contains(Current))
UndefBlks.push_back(Current);
- }
}
}
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index f2be3748799db..4b4a56be19fe5 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6929,10 +6929,9 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
DeadInterleavePointerOps.append(Op->op_begin(), Op->op_end());
}
- for (const auto &[_, Ops] : DeadInvariantStoreOps) {
- for (Value *Op : ArrayRef(Ops).drop_back())
- DeadOps.push_back(Op);
- }
+ for (const auto &[_, Ops] : DeadInvariantStoreOps)
+ llvm::append_range(DeadOps, ArrayRef(Ops).drop_back());
+
// Mark ops that would be trivially dead and are only used by ignored
// instructions as free.
BasicBlock *Header = TheLoop->getHeader();
More information about the llvm-commits
mailing list