Skip to content

Commit 41b7611

Browse files
[llvm] Use range constructors for *Set (NFC) (#132636)
1 parent 49ce038 commit 41b7611

File tree

11 files changed

+15
-24
lines changed

11 files changed

+15
-24
lines changed

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7576,8 +7576,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
75767576
else if (FalseBlock == nullptr)
75777577
FalseBlock = StartBlock;
75787578

7579-
SmallPtrSet<const Instruction *, 2> INS;
7580-
INS.insert_range(ASI);
7579+
SmallPtrSet<const Instruction *, 2> INS(llvm::from_range, ASI);
75817580
// Use reverse iterator because later select may use the value of the
75827581
// earlier select, and we need to propagate value through earlier select
75837582
// to get the PHI operand.

llvm/lib/IR/Metadata.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,8 +1635,7 @@ void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
16351635
if (!Value::hasMetadata())
16361636
return; // Nothing to remove!
16371637

1638-
SmallSet<unsigned, 32> KnownSet;
1639-
KnownSet.insert_range(KnownIDs);
1638+
SmallSet<unsigned, 32> KnownSet(llvm::from_range, KnownIDs);
16401639

16411640
// A DIAssignID attachment is debug metadata, don't drop it.
16421641
KnownSet.insert(LLVMContext::MD_DIAssignID);

llvm/lib/Target/AArch64/AArch64Subtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,7 @@ AArch64Subtarget::AArch64Subtarget(const Triple &TT, StringRef CPU,
394394
RegBankInfo.reset(RBI);
395395

396396
auto TRI = getRegisterInfo();
397-
StringSet<> ReservedRegNames;
398-
ReservedRegNames.insert_range(ReservedRegsForRA);
397+
StringSet<> ReservedRegNames(llvm::from_range, ReservedRegsForRA);
399398
for (unsigned i = 0; i < 29; ++i) {
400399
if (ReservedRegNames.count(TRI->getName(AArch64::X0 + i)))
401400
ReserveXRegisterForRA.set(i);

llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,7 @@ bool LowOverheadLoop::ValidateTailPredicate() {
794794
!RDA.hasLocalDefBefore(VCTP, VCTP->getOperand(1).getReg())) {
795795
if (auto *Def = RDA.getUniqueReachingMIDef(
796796
&Preheader->back(), VCTP->getOperand(1).getReg().asMCReg())) {
797-
SmallPtrSet<MachineInstr*, 2> Ignore;
798-
Ignore.insert_range(VCTPs);
797+
SmallPtrSet<MachineInstr *, 2> Ignore(llvm::from_range, VCTPs);
799798
TryRemove(Def, RDA, ToRemove, Ignore);
800799
}
801800
}

llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ static void addHints(ArrayRef<MCPhysReg> Order,
5858
SmallVectorImpl<MCPhysReg> &Hints,
5959
const TargetRegisterClass *RC,
6060
const MachineRegisterInfo *MRI) {
61-
SmallSet<unsigned, 4> CopyHints;
62-
CopyHints.insert_range(Hints);
61+
SmallSet<unsigned, 4> CopyHints(llvm::from_range, Hints);
6362
Hints.clear();
6463
for (MCPhysReg Reg : Order)
6564
if (CopyHints.count(Reg) &&

llvm/lib/Target/X86/X86RegisterInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,7 @@ bool X86RegisterInfo::getRegAllocationHints(Register VirtReg,
12131213
Hints.push_back(PhysReg);
12141214
};
12151215

1216-
SmallSet<MCPhysReg, 4> CopyHints;
1217-
CopyHints.insert_range(Hints);
1216+
SmallSet<MCPhysReg, 4> CopyHints(llvm::from_range, Hints);
12181217
Hints.clear();
12191218
for (auto Hint : CopyHints) {
12201219
if (RC.contains(Hint) && !MRI->isReserved(Hint))

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,9 +967,7 @@ void FunctionInstrumenter::instrument() {
967967
InstrumentBBs.size() + FuncInfo.SIVisitor.getNumOfSelectInsts();
968968

969969
if (IsCtxProf) {
970-
StringSet<> SkipCSInstr;
971-
SkipCSInstr.insert(CtxPGOSkipCallsiteInstrument.begin(),
972-
CtxPGOSkipCallsiteInstrument.end());
970+
StringSet<> SkipCSInstr(llvm::from_range, CtxPGOSkipCallsiteInstrument);
973971

974972
auto *CSIntrinsic =
975973
Intrinsic::getOrInsertDeclaration(&M, Intrinsic::instrprof_callsite);

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,10 @@ class ControlFlowHoister {
688688
// intersection of their successors is non-empty.
689689
// TODO: This could be expanded to allowing branches where both ends
690690
// eventually converge to a single block.
691-
SmallPtrSet<BasicBlock *, 4> TrueDestSucc, FalseDestSucc;
692-
TrueDestSucc.insert_range(successors(TrueDest));
693-
FalseDestSucc.insert_range(successors(FalseDest));
691+
SmallPtrSet<BasicBlock *, 4> TrueDestSucc(llvm::from_range,
692+
successors(TrueDest));
693+
SmallPtrSet<BasicBlock *, 4> FalseDestSucc(llvm::from_range,
694+
successors(FalseDest));
694695
BasicBlock *CommonSucc = nullptr;
695696
if (TrueDestSucc.count(FalseDest)) {
696697
CommonSucc = FalseDest;

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,7 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
700700
// Finally, the blocks from loopinfo. This has to happen late because
701701
// otherwise our loop iterators won't work.
702702

703-
SmallPtrSet<BasicBlock *, 8> blocks;
704-
blocks.insert_range(L->blocks());
703+
SmallPtrSet<BasicBlock *, 8> blocks(llvm::from_range, L->blocks());
705704
for (BasicBlock *BB : blocks)
706705
LI->removeBlock(BB);
707706

llvm/tools/llvm-exegesis/lib/Clustering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ void BenchmarkClustering::clusterizeDbScan(const size_t MinPts) {
148148
CurrentCluster.PointIndices.push_back(P);
149149

150150
// Process P's neighbors.
151-
SetVector<size_t, std::deque<size_t>> ToProcess;
152-
ToProcess.insert_range(Neighbors);
151+
SetVector<size_t, std::deque<size_t>> ToProcess(llvm::from_range,
152+
Neighbors);
153153
while (!ToProcess.empty()) {
154154
// Retrieve a point from the set.
155155
const size_t Q = *ToProcess.begin();

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3321,8 +3321,7 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) {
33213321
std::vector<std::string> &Args = P->getArgList();
33223322
// Copy the args so we can take StringRefs to them.
33233323
auto ArgsCopy = Args;
3324-
SmallDenseSet<StringRef, 4> OperandsSet;
3325-
OperandsSet.insert_range(ArgsCopy);
3324+
SmallDenseSet<StringRef, 4> OperandsSet(llvm::from_range, ArgsCopy);
33263325

33273326
if (OperandsSet.count(""))
33283327
P->error("Cannot have unnamed 'node' values in pattern fragment!");

0 commit comments

Comments
 (0)