diff options
author | Kazu Hirata <kazu@google.com> | 2023-03-15 22:55:35 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-03-15 22:55:35 -0700 |
commit | 4e585e51c167f458c3a9072298c3d4e32a7fce31 (patch) | |
tree | 56cfe020f8c4d17355bd27c6018e72040ab9c40f /bolt | |
parent | 6c756486d44914bac6fb20513b8c41f1a5726c4c (diff) | |
download | llvm-4e585e51c167f458c3a9072298c3d4e32a7fce31.tar.gz |
Use *{Map,Set}::contains (NFC)
Diffstat (limited to 'bolt')
-rw-r--r-- | bolt/lib/Core/BinaryFunction.cpp | 5 | ||||
-rw-r--r-- | bolt/lib/Passes/ReorderFunctions.cpp | 2 | ||||
-rw-r--r-- | bolt/lib/Profile/YAMLProfileReader.cpp | 4 | ||||
-rw-r--r-- | bolt/lib/Rewrite/RewriteInstance.cpp | 3 |
4 files changed, 6 insertions, 8 deletions
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index e91eb10a85a4..1cbdd6b2721b 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -2589,8 +2589,7 @@ struct CFISnapshotDiff : public CFISnapshot { if (RestoredRegs[Reg]) return true; RestoredRegs[Reg] = true; - const int32_t CurRegRule = - RegRule.find(Reg) != RegRule.end() ? RegRule[Reg] : UNKNOWN; + const int32_t CurRegRule = RegRule.contains(Reg) ? RegRule[Reg] : UNKNOWN; if (CurRegRule == UNKNOWN) { if (Instr.getOperation() == MCCFIInstruction::OpRestore || Instr.getOperation() == MCCFIInstruction::OpSameValue) @@ -2731,7 +2730,7 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState, Reg = *R; } - if (ToCFITable.RegRule.find(Reg) == ToCFITable.RegRule.end()) { + if (!ToCFITable.RegRule.contains(Reg)) { FrameInstructions.emplace_back( MCCFIInstruction::createRestore(nullptr, Reg)); if (FromCFITable.isRedundant(FrameInstructions.back())) { diff --git a/bolt/lib/Passes/ReorderFunctions.cpp b/bolt/lib/Passes/ReorderFunctions.cpp index 19ccf9f6fc80..2fc99f652bf1 100644 --- a/bolt/lib/Passes/ReorderFunctions.cpp +++ b/bolt/lib/Passes/ReorderFunctions.cpp @@ -360,7 +360,7 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) { } // Strip LTO suffixes if (std::optional<StringRef> CommonName = getLTOCommonName(Function)) - if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end()) + if (LTOCommonNameMap.contains(*CommonName)) llvm::append_range(FuncAddrs, LTOCommonNameMap[*CommonName]); } else { FuncAddrs.push_back(BD->getAddress()); diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp index d2ccadd62a17..13f56ed51c3a 100644 --- a/bolt/lib/Profile/YAMLProfileReader.cpp +++ b/bolt/lib/Profile/YAMLProfileReader.cpp @@ -285,10 +285,10 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) { bool YAMLProfileReader::mayHaveProfileData(const BinaryFunction &BF) { for (StringRef Name : BF.getNames()) { - if (ProfileNameToProfile.find(Name) != ProfileNameToProfile.end()) + if (ProfileNameToProfile.contains(Name)) return true; if (const std::optional<StringRef> CommonName = getLTOCommonName(Name)) { - if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end()) + if (LTOCommonNameMap.contains(*CommonName)) return true; } } diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index e191b937d42e..447c5d0aab93 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -5275,8 +5275,7 @@ RewriteInstance::patchELFAllocatableRelaSections(ELFObjectFile<ELFT> *File) { NewRelA.r_offset = RelOffset; NewRelA.r_addend = Addend; - const bool IsJmpRel = - !!(IsJmpRelocation.find(Rel.Type) != IsJmpRelocation.end()); + const bool IsJmpRel = IsJmpRelocation.contains(Rel.Type); uint64_t &Offset = IsJmpRel ? RelPltOffset : RelDynOffset; const uint64_t &EndOffset = IsJmpRel ? RelPltEndOffset : RelDynEndOffset; |