Skip to content

Commit c83c4b5

Browse files
[Transforms] Apply fixes from performance-for-range-copy (NFC)
1 parent 668045e commit c83c4b5

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
758758
auto UpdateCallers = [&](ContextNode *Node,
759759
DenseSet<const ContextEdge *> &Visited,
760760
auto &&UpdateCallers) -> void {
761-
for (auto Edge : Node->CallerEdges) {
761+
for (const auto &Edge : Node->CallerEdges) {
762762
auto Inserted = Visited.insert(Edge.get());
763763
if (!Inserted.second)
764764
continue;
@@ -1119,7 +1119,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::updateStackNodes() {
11191119
// not fully matching stack contexts. To do this, subtract any context ids
11201120
// found in caller nodes of the last node found above.
11211121
if (Ids.back() != getLastStackId(Call)) {
1122-
for (auto PE : LastNode->CallerEdges) {
1122+
for (const auto &PE : LastNode->CallerEdges) {
11231123
set_subtract(StackSequenceContextIds, PE->getContextIds());
11241124
if (StackSequenceContextIds.empty())
11251125
break;

llvm/lib/Transforms/IPO/PartialInlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ PartialInlinerImpl::FunctionCloner::FunctionCloner(
981981

982982
// Go through all Outline Candidate Regions and update all BasicBlock
983983
// information.
984-
for (FunctionOutliningMultiRegionInfo::OutlineRegionInfo RegionInfo :
984+
for (const FunctionOutliningMultiRegionInfo::OutlineRegionInfo &RegionInfo :
985985
OI->ORI) {
986986
SmallVector<BasicBlock *, 8> Region;
987987
for (BasicBlock *BB : RegionInfo.Region)

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ static uint64_t computeStackId(const memprof::Frame &Frame) {
13381338
static void addCallStack(CallStackTrie &AllocTrie,
13391339
const AllocationInfo *AllocInfo) {
13401340
SmallVector<uint64_t> StackIds;
1341-
for (auto StackFrame : AllocInfo->CallStack)
1341+
for (const auto &StackFrame : AllocInfo->CallStack)
13421342
StackIds.push_back(computeStackId(StackFrame));
13431343
auto AllocType = getAllocType(AllocInfo->Info.getMaxAccessCount(),
13441344
AllocInfo->Info.getMinSize(),

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ struct AllSwitchPaths {
582582
continue;
583583

584584
PathsType SuccPaths = paths(Succ, Visited, PathDepth + 1);
585-
for (PathType Path : SuccPaths) {
585+
for (const PathType &Path : SuccPaths) {
586586
PathType NewPath(Path);
587587
NewPath.push_front(BB);
588588
Res.push_back(NewPath);
@@ -935,7 +935,7 @@ struct TransformDFA {
935935
SSAUpdaterBulk SSAUpdate;
936936
SmallVector<Use *, 16> UsesToRename;
937937

938-
for (auto KV : NewDefs) {
938+
for (const auto &KV : NewDefs) {
939939
Instruction *I = KV.first;
940940
BasicBlock *BB = I->getParent();
941941
std::vector<Instruction *> Cloned = KV.second;

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ static int CalculateUnswitchCostMultiplier(
27622762
// Count amount of clones that all the candidates might cause during
27632763
// unswitching. Branch/guard counts as 1, switch counts as log2 of its cases.
27642764
int UnswitchedClones = 0;
2765-
for (auto Candidate : UnswitchCandidates) {
2765+
for (const auto &Candidate : UnswitchCandidates) {
27662766
const Instruction *CI = Candidate.TI;
27672767
const BasicBlock *CondBlock = CI->getParent();
27682768
bool SkipExitingSuccessors = DT.dominates(CondBlock, Latch);

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ Value *getSalvageOpsForGEP(GetElementPtrInst *GEP, const DataLayout &DL,
19481948
Opcodes.insert(Opcodes.begin(), {dwarf::DW_OP_LLVM_arg, 0});
19491949
CurrentLocOps = 1;
19501950
}
1951-
for (auto Offset : VariableOffsets) {
1951+
for (const auto &Offset : VariableOffsets) {
19521952
AdditionalValues.push_back(Offset.first);
19531953
assert(Offset.second.isStrictlyPositive() &&
19541954
"Expected strictly positive multiplier for offset.");

llvm/lib/Transforms/Utils/LoopVersioning.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void LoopVersioning::prepareNoAliasMetadata() {
210210
// Finally, transform the above to actually map to scope list which is what
211211
// the metadata uses.
212212

213-
for (auto Pair : GroupToNonAliasingScopes)
213+
for (const auto &Pair : GroupToNonAliasingScopes)
214214
GroupToNonAliasingScopeList[Pair.first] = MDNode::get(Context, Pair.second);
215215
}
216216

llvm/lib/Transforms/Utils/UnifyLoopExits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void restoreSSA(const DominatorTree &DT, const Loop *L,
113113
}
114114
}
115115

116-
for (auto II : ExternalUsers) {
116+
for (const auto &II : ExternalUsers) {
117117
// For each Def used outside the loop, create NewPhi in
118118
// LoopExitBlock. NewPhi receives Def only along exiting blocks that
119119
// dominate it, while the remaining values are undefined since those paths

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8492,7 +8492,7 @@ VPWidenCallRecipe *VPRecipeBuilder::tryToWidenCall(CallInst *CI,
84928492
VFShape Shape = VFShape::get(*CI, VariantVF, /*HasGlobalPred=*/true);
84938493
unsigned MaskPos = 0;
84948494

8495-
for (VFInfo Info : VFDatabase::getMappings(*CI))
8495+
for (const VFInfo &Info : VFDatabase::getMappings(*CI))
84968496
if (Info.Shape == Shape) {
84978497
assert(Info.isMasked() && "Vector function info shape mismatch");
84988498
MaskPos = Info.getParamIndexForOptionalMask().value();

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
15651565
// Calculate our ReconstructMasks from the OrigReconstructMasks and the
15661566
// modified order of the input shuffles.
15671567
SmallVector<SmallVector<int>> ReconstructMasks;
1568-
for (auto Mask : OrigReconstructMasks) {
1568+
for (const auto &Mask : OrigReconstructMasks) {
15691569
SmallVector<int> ReconstructMask;
15701570
for (int M : Mask) {
15711571
auto FindIndex = [](const SmallVector<std::pair<int, int>> &V, int M) {

0 commit comments

Comments
 (0)