Skip to content

Commit 7ada7bb

Browse files
[Target] Use *{Set,Map}::contains (NFC)
1 parent f198c50 commit 7ada7bb

13 files changed

+21
-21
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5263,10 +5263,10 @@ bool AMDGPUAsmParser::ParseDirectiveAMDHSAKernel() {
52635263
#undef PARSE_BITS_ENTRY
52645264
}
52655265

5266-
if (Seen.find(".amdhsa_next_free_vgpr") == Seen.end())
5266+
if (!Seen.contains(".amdhsa_next_free_vgpr"))
52675267
return TokError(".amdhsa_next_free_vgpr directive is required");
52685268

5269-
if (Seen.find(".amdhsa_next_free_sgpr") == Seen.end())
5269+
if (!Seen.contains(".amdhsa_next_free_sgpr"))
52705270
return TokError(".amdhsa_next_free_sgpr directive is required");
52715271

52725272
unsigned VGPRBlocks;
@@ -5304,7 +5304,7 @@ bool AMDGPUAsmParser::ParseDirectiveAMDHSAKernel() {
53045304
UserSGPRCount);
53055305

53065306
if (isGFX90A()) {
5307-
if (Seen.find(".amdhsa_accum_offset") == Seen.end())
5307+
if (!Seen.contains(".amdhsa_accum_offset"))
53085308
return TokError(".amdhsa_accum_offset directive is required");
53095309
if (AccumOffset < 4 || AccumOffset > 256 || (AccumOffset & 3))
53105310
return TokError("accum_offset should be in range [4..256] in "

llvm/lib/Target/AMDGPU/R600ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,15 +1656,15 @@ SDValue R600TargetLowering::OptimizeSwizzle(SDValue BuildVector, SDValue Swz[],
16561656
BuildVector = CompactSwizzlableVector(DAG, BuildVector, SwizzleRemap);
16571657
for (unsigned i = 0; i < 4; i++) {
16581658
unsigned Idx = cast<ConstantSDNode>(Swz[i])->getZExtValue();
1659-
if (SwizzleRemap.find(Idx) != SwizzleRemap.end())
1659+
if (SwizzleRemap.contains(Idx))
16601660
Swz[i] = DAG.getConstant(SwizzleRemap[Idx], DL, MVT::i32);
16611661
}
16621662

16631663
SwizzleRemap.clear();
16641664
BuildVector = ReorganizeVector(DAG, BuildVector, SwizzleRemap);
16651665
for (unsigned i = 0; i < 4; i++) {
16661666
unsigned Idx = cast<ConstantSDNode>(Swz[i])->getZExtValue();
1667-
if (SwizzleRemap.find(Idx) != SwizzleRemap.end())
1667+
if (SwizzleRemap.contains(Idx))
16681668
Swz[i] = DAG.getConstant(SwizzleRemap[Idx], DL, MVT::i32);
16691669
}
16701670

llvm/lib/Target/AMDGPU/R600InstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ R600InstrInfo::ExtractSrcs(MachineInstr &MI,
328328
if (Reg == R600::OQAP) {
329329
Result.push_back(std::pair(Index, 0U));
330330
}
331-
if (PV.find(Reg) != PV.end()) {
331+
if (PV.contains(Reg)) {
332332
// 255 is used to tells its a PS/PV reg
333333
Result.push_back(std::pair(255, 0U));
334334
continue;

llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ bool SILoadStoreOptimizer::promoteConstantOffsetToImm(
20922092
// Step1: Find the base-registers and a 64bit constant offset.
20932093
MachineOperand &Base = *TII->getNamedOperand(MI, AMDGPU::OpName::vaddr);
20942094
MemAddress MAddr;
2095-
if (Visited.find(&MI) == Visited.end()) {
2095+
if (!Visited.contains(&MI)) {
20962096
processBaseWithConstOffset(Base, MAddr);
20972097
Visited[&MI] = MAddr;
20982098
} else
@@ -2155,7 +2155,7 @@ bool SILoadStoreOptimizer::promoteConstantOffsetToImm(
21552155
const MachineOperand &BaseNext =
21562156
*TII->getNamedOperand(MINext, AMDGPU::OpName::vaddr);
21572157
MemAddress MAddrNext;
2158-
if (Visited.find(&MINext) == Visited.end()) {
2158+
if (!Visited.contains(&MINext)) {
21592159
processBaseWithConstOffset(BaseNext, MAddrNext);
21602160
Visited[&MINext] = MAddrNext;
21612161
} else

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction {
578578
// Check if an entry created for \p Reg in PrologEpilogSGPRSpills. Return true
579579
// on success and false otherwise.
580580
bool hasPrologEpilogSGPRSpillEntry(Register Reg) const {
581-
return PrologEpilogSGPRSpills.find(Reg) != PrologEpilogSGPRSpills.end();
581+
return PrologEpilogSGPRSpills.contains(Reg);
582582
}
583583

584584
// Get the scratch SGPR if allocated to save/restore \p Reg.

llvm/lib/Target/BPF/BTFDebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ std::string BTFDebug::populateFileContent(const DISubprogram *SP) {
982982
FileName = std::string(File->getFilename());
983983

984984
// No need to populate the contends if it has been populated!
985-
if (FileContent.find(FileName) != FileContent.end())
985+
if (FileContent.contains(FileName))
986986
return FileName;
987987

988988
std::vector<std::string> Content;

llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ void Simplifier::Context::initialize(Instruction *Exp) {
336336

337337
while (!Q.empty()) {
338338
Value *V = Q.pop_front_val();
339-
if (M.find(V) != M.end())
339+
if (M.contains(V))
340340
continue;
341341
if (Instruction *U = dyn_cast<Instruction>(V)) {
342342
if (isa<PHINode>(U) || U->getParent() != Block)

llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ static bool useFuncSeen(const Constant *C,
700700
const Function *caller = bb->getParent();
701701
if (!caller)
702702
continue;
703-
if (seenMap.find(caller) != seenMap.end())
703+
if (seenMap.contains(caller))
704704
return true;
705705
}
706706
}
@@ -753,7 +753,7 @@ void NVPTXAsmPrinter::emitDeclarations(const Module &M, raw_ostream &O) {
753753
// If a caller has already been seen, then the caller is
754754
// appearing in the module before the callee. so print out
755755
// a declaration for the callee.
756-
if (seenMap.find(caller) != seenMap.end()) {
756+
if (seenMap.contains(caller)) {
757757
emitDeclaration(&F, O);
758758
break;
759759
}

llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ bool PPCLoopInstrFormPrep::prepareBaseForDispFormChain(Bucket &BucketChain,
910910
unsigned Remainder = cast<SCEVConstant>(BucketChain.Elements[j].Offset)
911911
->getAPInt()
912912
.urem(Form);
913-
if (RemainderOffsetInfo.find(Remainder) == RemainderOffsetInfo.end())
913+
if (!RemainderOffsetInfo.contains(Remainder))
914914
RemainderOffsetInfo[Remainder] = std::make_pair(j, 1);
915915
else
916916
RemainderOffsetInfo[Remainder].second++;
@@ -933,7 +933,7 @@ bool PPCLoopInstrFormPrep::prepareBaseForDispFormChain(Bucket &BucketChain,
933933
// 1 X form.
934934
unsigned MaxCountRemainder = 0;
935935
for (unsigned j = 0; j < (unsigned)Form; j++)
936-
if ((RemainderOffsetInfo.find(j) != RemainderOffsetInfo.end()) &&
936+
if ((RemainderOffsetInfo.contains(j)) &&
937937
RemainderOffsetInfo[j].second >
938938
RemainderOffsetInfo[MaxCountRemainder].second)
939939
MaxCountRemainder = j;

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7580,10 +7580,10 @@ static void createPHIsForSelects(SmallVector<MachineInstr*, 8> &Selects,
75807580
if (MI->getOperand(4).getImm() == (CCValid ^ CCMask))
75817581
std::swap(TrueReg, FalseReg);
75827582

7583-
if (RegRewriteTable.find(TrueReg) != RegRewriteTable.end())
7583+
if (RegRewriteTable.contains(TrueReg))
75847584
TrueReg = RegRewriteTable[TrueReg].first;
75857585

7586-
if (RegRewriteTable.find(FalseReg) != RegRewriteTable.end())
7586+
if (RegRewriteTable.contains(FalseReg))
75877587
FalseReg = RegRewriteTable[FalseReg].second;
75887588

75897589
DebugLoc DL = MI->getDebugLoc();

llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ Function *WebAssemblyLowerEmscriptenEHSjLj::getInvokeWrapper(CallBase *CI) {
580580
FunctionType *CalleeFTy = CI->getFunctionType();
581581

582582
std::string Sig = getSignature(CalleeFTy);
583-
if (InvokeWrappers.find(Sig) != InvokeWrappers.end())
583+
if (InvokeWrappers.contains(Sig))
584584
return InvokeWrappers[Sig];
585585

586586
// Put the pointer to the callee as first argument

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35961,10 +35961,10 @@ static MachineInstrBuilder createPHIsForCMOVsInSinkBB(
3596135961
if (MIIt->getOperand(3).getImm() == OppCC)
3596235962
std::swap(Op1Reg, Op2Reg);
3596335963

35964-
if (RegRewriteTable.find(Op1Reg) != RegRewriteTable.end())
35964+
if (RegRewriteTable.contains(Op1Reg))
3596535965
Op1Reg = RegRewriteTable[Op1Reg].first;
3596635966

35967-
if (RegRewriteTable.find(Op2Reg) != RegRewriteTable.end())
35967+
if (RegRewriteTable.contains(Op2Reg))
3596835968
Op2Reg = RegRewriteTable[Op2Reg].second;
3596935969

3597035970
MIB = BuildMI(*SinkMBB, SinkInsertionPoint, DL, TII->get(X86::PHI), DestReg)

llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ X86LoadValueInjectionLoadHardeningPass::getGadgetGraph(
362362
SmallSet<NodeId, 8> UsesVisited, DefsVisited;
363363
std::function<void(NodeAddr<DefNode *>)> AnalyzeDefUseChain =
364364
[&](NodeAddr<DefNode *> Def) {
365-
if (Transmitters.find(Def.Id) != Transmitters.end())
365+
if (Transmitters.contains(Def.Id))
366366
return; // Already analyzed `Def`
367367

368368
// Use RDF to find all the uses of `Def`

0 commit comments

Comments
 (0)