llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

Return a pair of iterator and bool, instead of a plain bool, like all other ADT 
structures. This is a nice-to-have that does not degrade compile time, as the 
iterator is never used.

-- 8&lt; --
>From c-t-t: 
>https://llvm-compile-time-tracker.com/compare.php?from=d3ad7fe9f82ea7aa48755320c03233acd7db7938&amp;to=05b11e98513289ed4fa841a622bda57a1853785e&amp;stat=instructions:u.

---

Patch is 52.96 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/232372.diff


65 Files Affected:

- (modified) clang/include/clang/Sema/Weak.h (+4-2) 
- (modified) clang/lib/APINotes/APINotesManager.cpp (+1-1) 
- (modified) clang/lib/AST/VTableBuilder.cpp (+3-3) 
- (modified) clang/lib/CodeGen/CGCleanup.h (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaLookup.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaOverload.cpp (+2-2) 
- (modified) clang/lib/Serialization/ASTWriter.cpp (+2-1) 
- (modified) lld/ELF/Driver.cpp (+1-1) 
- (modified) lld/MachO/SyntheticSections.cpp (+3-3) 
- (modified) lld/include/lld/Common/BPSectionOrdererBase.inc (+3-3) 
- (modified) llvm/include/llvm/ADT/CachedHashString.h (+3) 
- (modified) llvm/include/llvm/ADT/DirectedGraph.h (+1-1) 
- (modified) llvm/include/llvm/ADT/GenericUniformityImpl.h (+1-1) 
- (modified) llvm/include/llvm/ADT/SetVector.h (+10-7) 
- (modified) llvm/include/llvm/CodeGen/MachinePipeliner.h (+1-1) 
- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+6) 
- (modified) llvm/include/llvm/MC/MCContext.h (+1-1) 
- (modified) llvm/include/llvm/Transforms/Utils/InstructionWorklist.h (+1-1) 
- (modified) llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp (+1-2) 
- (modified) llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/MachineInstrBundle.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (+7-7) 
- (modified) llvm/lib/IR/ReplaceConstant.cpp (+1-1) 
- (modified) llvm/lib/IR/SafepointIRVerifier.cpp (+1-1) 
- (modified) llvm/lib/Linker/IRMover.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/AArch64FrameLowering.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCoExecSchedStrategy.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+3-3) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/SpillUtils.cpp (+2-2) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+7-7) 
- (modified) llvm/lib/Transforms/IPO/FunctionImport.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+4-4) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 
(+2-2) 
- (modified) llvm/lib/Transforms/Scalar/LoopDistribute.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/CodeExtractor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/InlineFunction.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/LCSSA.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+1-1) 
- (modified) llvm/unittests/IR/DebugInfoTest.cpp (+2-2) 
- (modified) llvm/utils/TableGen/AsmMatcherEmitter.cpp (+4-3) 
- (modified) llvm/utils/TableGen/Basic/AMDGPUTargetDefEmitter.cpp (+1-1) 
- (modified) llvm/utils/TableGen/Common/CodeGenRegisters.cpp (+2-2) 
- (modified) mlir/include/mlir/TableGen/Pattern.h (+2) 
- (modified) mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp (+2-2) 
- (modified) mlir/lib/Analysis/DataFlowFramework.cpp (+2-2) 
- (modified) mlir/lib/Bytecode/Writer/IRNumbering.cpp (+1-1) 
- (modified) mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp 
(+2-2) 
- (modified) 
mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp (+1-1) 
- (modified) mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp (+1-1) 
- (modified) mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp (+1-1) 
- (modified) mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp (+1-1) 
- (modified) mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp (+1-1) 
- (modified) mlir/tools/mlir-tblgen/OpFormatGen.cpp (+2-2) 
- (modified) polly/lib/Analysis/ScopBuilder.cpp (+1-1) 
- (modified) polly/lib/Analysis/ScopDetection.cpp (+1-1) 
- (modified) polly/lib/Analysis/ScopInfo.cpp (+1-1) 
- (modified) polly/lib/CodeGen/BlockGenerators.cpp (+1-1) 


``````````diff
diff --git a/clang/include/clang/Sema/Weak.h b/clang/include/clang/Sema/Weak.h
index 60341086abf61a..fb3d034f375332 100644
--- a/clang/include/clang/Sema/Weak.h
+++ b/clang/include/clang/Sema/Weak.h
@@ -31,8 +31,10 @@ class WeakInfo {
       : alias(Alias), loc(Loc) {}
   inline const IdentifierInfo *getAlias() const { return alias; }
   inline SourceLocation getLocation() const { return loc; }
-  bool operator==(WeakInfo RHS) const = delete;
-  bool operator!=(WeakInfo RHS) const = delete;
+  bool operator==(const WeakInfo &RHS) const {
+    return getAlias() == RHS.getAlias() && getLocation() == RHS.getLocation();
+  }
+  bool operator!=(const WeakInfo &RHS) const { return !(*this == RHS); }
 
   struct DenseMapInfoByAliasOnly
       : private llvm::DenseMapInfo<const IdentifierInfo *> {
diff --git a/clang/lib/APINotes/APINotesManager.cpp 
b/clang/lib/APINotes/APINotesManager.cpp
index 2cc801d5415b84..53013834705ab2 100644
--- a/clang/lib/APINotes/APINotesManager.cpp
+++ b/clang/lib/APINotes/APINotesManager.cpp
@@ -452,7 +452,7 @@ APINotesManager::findAPINotes(SourceLocation Loc) {
     }
 
     // We didn't find anything. Look at the parent directory.
-    if (!DirsVisited.insert(*Dir)) {
+    if (!DirsVisited.insert(*Dir).second) {
       Dir = std::nullopt;
       break;
     }
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp
index 3c05d4b22b03e1..e079678ba2d0dd 100644
--- a/clang/lib/AST/VTableBuilder.cpp
+++ b/clang/lib/AST/VTableBuilder.cpp
@@ -1430,7 +1430,7 @@ bool ItaniumVTableBuilder::IsOverriderUsed(
              "Primary base should always be at offset 0!");
     }
 
-    if (!PrimaryBases.insert(PrimaryBase))
+    if (!PrimaryBases.insert(PrimaryBase).second)
       llvm_unreachable("Found a duplicate primary base!");
 
     RD = PrimaryBase;
@@ -1511,7 +1511,7 @@ void ItaniumVTableBuilder::AddMethods(
                PrimaryBaseOffsetInLayoutClass, FirstBaseInPrimaryBaseChain,
                FirstBaseOffsetInLayoutClass, PrimaryBases);
 
-    if (!PrimaryBases.insert(PrimaryBase))
+    if (!PrimaryBases.insert(PrimaryBase).second)
       llvm_unreachable("Found a duplicate primary base!");
   }
 
@@ -3072,7 +3072,7 @@ void VFTableBuilder::AddMethods(BaseSubobject Base, 
unsigned BaseDepth,
   if (NextBase) {
     AddMethods(BaseSubobject(NextBase, NextBaseOffset), BaseDepth + 1,
                NextLastVBase, VisitedBases);
-    if (!VisitedBases.insert(NextBase))
+    if (!VisitedBases.insert(NextBase).second)
       llvm_unreachable("Found a duplicate primary base!");
   }
 
diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h
index fd8206fbccfe18..f8dc11ada379ab 100644
--- a/clang/lib/CodeGen/CGCleanup.h
+++ b/clang/lib/CodeGen/CGCleanup.h
@@ -310,7 +310,7 @@ class alignas(8) EHCleanupScope : public EHScope {
   private:
     void CollectUses(llvm::Instruction *I,
                      llvm::SetVector<llvm::Instruction *> &Uses) {
-      if (!I || !Uses.insert(I))
+      if (!I || !Uses.insert(I).second)
         return;
       for (auto *User : I->users())
         CollectUses(cast<llvm::Instruction>(User), Uses);
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index f5fd8b7b904351..4b785bff5f4da8 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -8202,7 +8202,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
     auto *Import = cast<ImportDecl>(D);
 
     // If we've already imported this module, we're done.
-    if (!ImportedModules.insert(Import->getImportedModule()))
+    if (!ImportedModules.insert(Import->getImportedModule()).second)
       break;
 
     // Emit debug information for direct imports.
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index bc8a30d4e9dad4..22fcb6b97fa916 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -2901,7 +2901,7 @@ namespace {
 
     bool addClassTransitive(CXXRecordDecl *RD) {
       Classes.insert(RD);
-      return ClassesTransitive.insert(RD);
+      return ClassesTransitive.insert(RD).second;
     }
 
     Sema &S;
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 62b6ad8ffb5644..a64ce4ab97fa6e 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -9272,7 +9272,7 @@ 
BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
                                              const Qualifiers &VisibleQuals) {
 
   // Insert this type.
-  if (!PointerTypes.insert(Ty))
+  if (!PointerTypes.insert(Ty).second)
     return false;
 
   QualType PointeeTy;
@@ -9340,7 +9340,7 @@ bool
 BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
     QualType Ty) {
   // Insert this type.
-  if (!MemberPointerTypes.insert(Ty))
+  if (!MemberPointerTypes.insert(Ty).second)
     return false;
 
   const MemberPointerType *PointerTy = Ty->getAs<MemberPointerType>();
diff --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index 0afba1c84fd627..8e870a7b817a0a 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -7791,7 +7791,8 @@ void ASTWriter::AddedVisibleDecl(const DeclContext *DC, 
const Decl *D) {
   assert(DC == DC->getPrimaryContext() && "added to non-primary context");
   assert(!getDefinitiveDeclContext(DC) && "DeclContext not definitive!");
   assert(!WritingAST && "Already writing the AST!");
-  if (UpdatedDeclContexts.insert(DC) && !cast<Decl>(DC)->isFromASTFile()) {
+  if (UpdatedDeclContexts.insert(DC).second &&
+      !cast<Decl>(DC)->isFromASTFile()) {
     // We're adding a visible declaration to a predefined decl context. Ensure
     // that we write out all of its lookup results so we don't get a nasty
     // surprise when we try to emit its lookup table.
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 134aae9ef98ad5..f4806a141a088f 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1336,7 +1336,7 @@ static SmallVector<StringRef, 0> 
getSymbolOrderingFile(Ctx &ctx,
                                                        MemoryBufferRef mb) {
   SetVector<StringRef, SmallVector<StringRef, 0>> names;
   for (StringRef s : args::getLines(mb))
-    if (!names.insert(s) && ctx.arg.warnSymbolOrdering)
+    if (!names.insert(s).second && ctx.arg.warnSymbolOrdering)
       Warn(ctx) << mb.getBufferIdentifier()
                 << ": duplicate ordered symbol: " << s;
 
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index cc7aaa2c7ee9fe..2492790285fe20 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -337,7 +337,7 @@ void macho::addNonLazyBindingEntries(const Symbol *sym,
 }
 
 void GotSection::addEntry(Symbol *sym) {
-  if (entries.insert(sym)) {
+  if (entries.insert(sym).second) {
     // Every symbol has at most one non-lazy pointer slot.
     assert(!sym->isInGot());
     sym->gotIndex = entries.size() - 1;
@@ -746,7 +746,7 @@ static void addBindingsForStub(Symbol *sym) {
 }
 
 void StubsSection::addEntry(Symbol *sym) {
-  bool inserted = entries.insert(sym);
+  bool inserted = entries.insert(sym).second;
   if (inserted) {
     sym->stubsIndex = entries.size() - 1;
 
@@ -1011,7 +1011,7 @@ void LazyBindingSection::writeTo(uint8_t *buf) const {
 
 void LazyBindingSection::addEntry(Symbol *sym) {
   assert(!config->emitChainedFixups && "Chained fixups always bind eagerly");
-  if (entries.insert(sym)) {
+  if (entries.insert(sym).second) {
     sym->stubsHelperIndex = entries.size() - 1;
     in.rebase->addEntry(in.lazyPointers->isec,
                         sym->stubsIndex * target->wordSize);
diff --git a/lld/include/lld/Common/BPSectionOrdererBase.inc 
b/lld/include/lld/Common/BPSectionOrdererBase.inc
index 841c46110ae0f1..a88026ef935bf5 100644
--- a/lld/include/lld/Common/BPSectionOrdererBase.inc
+++ b/lld/include/lld/Common/BPSectionOrdererBase.inc
@@ -381,7 +381,7 @@ auto BPOrderer<D>::computeOrder(
   // Order startup functions,
   for (auto &node : nodesForStartup) {
     const auto *isec = sections[node.Id];
-    if (orderedSections.insert(isec)) {
+    if (orderedSections.insert(isec).second) {
       startupSize += D::getSize(*isec);
       ++numStartupSections;
     }
@@ -390,7 +390,7 @@ auto BPOrderer<D>::computeOrder(
   for (const auto &nodes : nodesForCompression) {
     for (auto &node : nodes) {
       const auto *isec = sections[node.Id];
-      if (orderedSections.insert(isec)) {
+      if (orderedSections.insert(isec).second) {
         compressionSize += D::getSize(*isec);
         ++numCompressionSections;
       }
@@ -399,7 +399,7 @@ auto BPOrderer<D>::computeOrder(
         continue;
       for (auto dupSecIdx : It->getSecond()) {
         const auto *dupIsec = sections[dupSecIdx];
-        if (orderedSections.insert(dupIsec)) {
+        if (orderedSections.insert(dupIsec).second) {
           duplicateCompressionSize += D::getSize(*dupIsec);
           ++numDuplicateCompressionSections;
         }
diff --git a/llvm/include/llvm/ADT/CachedHashString.h 
b/llvm/include/llvm/ADT/CachedHashString.h
index 902951d0011bc1..169d8035706165 100644
--- a/llvm/include/llvm/ADT/CachedHashString.h
+++ b/llvm/include/llvm/ADT/CachedHashString.h
@@ -40,6 +40,9 @@ class CachedHashStringRef {
       : P(S.data()), Size(S.size()), Hash(Hash) {
     assert(S.size() <= std::numeric_limits<uint32_t>::max());
   }
+  bool operator==(const CachedHashStringRef &Other) const {
+    return hash() == Other.hash() && val() == Other.val();
+  }
 
   StringRef val() const { return StringRef(P, Size); }
   const char *data() const { return P; }
diff --git a/llvm/include/llvm/ADT/DirectedGraph.h 
b/llvm/include/llvm/ADT/DirectedGraph.h
index fe7c9e51cbd9af..e15c18f7970359 100644
--- a/llvm/include/llvm/ADT/DirectedGraph.h
+++ b/llvm/include/llvm/ADT/DirectedGraph.h
@@ -112,7 +112,7 @@ template <class NodeType, class EdgeType> class DGNode {
 
   /// Add the given edge \p E to this node, if it doesn't exist already. 
Returns
   /// true if the edge is added and false otherwise.
-  bool addEdge(EdgeType &E) { return Edges.insert(&E); }
+  bool addEdge(EdgeType &E) { return Edges.insert(&E).second; }
 
   /// Remove the given edge \p E from this node, if it exists.
   void removeEdge(EdgeType &E) { Edges.remove(&E); }
diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h 
b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index c6f0bba051b609..7fcc13f6f01006 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -924,7 +924,7 @@ void 
GenericUniformityAnalysisImpl<ContextT>::propagateCycleExitDivergence(
   LLVM_DEBUG(dbgs() << "\tOuter-most exiting cycle: "
                     << Context.print(CI.getHeader(OuterDivCycle)) << "\n");
 
-  if (!DivergentExitCycles.insert(OuterDivCycle))
+  if (!DivergentExitCycles.insert(OuterDivCycle).second)
     return;
 
   // Exit divergence does not matter if the cycle itself is assumed to
diff --git a/llvm/include/llvm/ADT/SetVector.h 
b/llvm/include/llvm/ADT/SetVector.h
index bc0ac2583327b3..24defb802c9c16 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -153,23 +153,26 @@ class SetVector {
   }
 
   /// Insert a new element into the SetVector.
-  /// \returns true if the element was inserted into the SetVector.
-  bool insert(const value_type &X) {
+  /// \returns a pair, whose first member is the iterator pointed to the
+  /// element, and the second member indicates if the element was inserted.
+  std::pair<iterator, bool> insert(const value_type &X) {
     if constexpr (canBeSmall())
       if (isSmall()) {
         if (!llvm::is_contained(vector_, X)) {
           vector_.push_back(X);
           if (vector_.size() > N)
             makeBig();
-          return true;
+          return {std::prev(vector_.end()), true};
         }
-        return false;
+        return {find(vector_, X), false};
       }
 
     bool result = set_.insert(X).second;
-    if (result)
+    if (result) {
       vector_.push_back(X);
-    return result;
+      return {std::prev(vector_.end()), result};
+    }
+    return {find(vector_, X), result};
   }
 
   /// Insert a range of elements into the SetVector.
@@ -304,7 +307,7 @@ class SetVector {
     bool Changed = false;
 
     for (const auto &Elem : S)
-      if (insert(Elem))
+      if (insert(Elem).second)
         Changed = true;
 
     return Changed;
diff --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h 
b/llvm/include/llvm/CodeGen/MachinePipeliner.h
index 9b8beef1a1677b..24d5e9dcf1deef 100644
--- a/llvm/include/llvm/CodeGen/MachinePipeliner.h
+++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h
@@ -529,7 +529,7 @@ class NodeSet {
     Latency = SUnitToDistance[Nodes.front()];
   }
 
-  bool insert(SUnit *SU) { return Nodes.insert(SU); }
+  bool insert(SUnit *SU) { return Nodes.insert(SU).second; }
 
   void insert(iterator S, iterator E) { Nodes.insert(S, E); }
 
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 4f68582b65c4eb..c34efcc946f580 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -841,6 +841,9 @@ class FunctionSummary : public GlobalValueSummary {
   struct VFuncId {
     GlobalValue::GUID GUID;
     uint64_t Offset;
+    bool operator==(const VFuncId &Other) const {
+      return GUID == Other.GUID && Offset == Other.Offset;
+    }
   };
 
   /// A specification for a virtual function call with all constant integer
@@ -849,6 +852,9 @@ class FunctionSummary : public GlobalValueSummary {
   struct ConstVCall {
     VFuncId VFunc;
     std::vector<uint64_t> Args;
+    bool operator==(const ConstVCall &Other) const {
+      return VFunc == Other.VFunc && Args == Other.Args;
+    }
   };
 
   /// All type identifier related information. Because these fields are
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 7e76abe08f56f7..026ecd5f985a91 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -788,7 +788,7 @@ class MCContext {
   }
 
   bool addGenDwarfSection(MCSection *Sec) {
-    return SectionsForRanges.insert(Sec);
+    return SectionsForRanges.insert(Sec).second;
   }
 
   LLVM_ABI void finalizeDwarfSections(MCStreamer &MCOS);
diff --git a/llvm/include/llvm/Transforms/Utils/InstructionWorklist.h 
b/llvm/include/llvm/Transforms/Utils/InstructionWorklist.h
index 5a46fff651336b..a1b6f7967a946a 100644
--- a/llvm/include/llvm/Transforms/Utils/InstructionWorklist.h
+++ b/llvm/include/llvm/Transforms/Utils/InstructionWorklist.h
@@ -42,7 +42,7 @@ class InstructionWorklist {
   /// Instructions will be visited in the order they are added.
   /// You likely want to use this method.
   void add(Instruction *I) {
-    if (Deferred.insert(I))
+    if (Deferred.insert(I).second)
       LLVM_DEBUG(dbgs() << "ADD DEFERRED: " << *I << '\n');
   }
 
diff --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp 
b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
index 5c3bd1bc1edd42..bd6bbec05a0e66 100644
--- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
+++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
@@ -558,8 +558,7 @@ void 
FunctionPropertiesUpdater::finish(FunctionAnalysisManager &FAM) const {
   // ending at those successors, we also want to perform a traversal.
   // IncludeSuccessorsMark is the index after which we include successors.
   const auto IncludeSuccessorsMark = Reinclude.size();
-  bool CSInsertion = Reinclude.insert(&CallSiteBB);
-  (void)CSInsertion;
+  [[maybe_unused]] bool CSInsertion = Reinclude.insert(&CallSiteBB).second;
   assert(CSInsertion);
   for (size_t I = 0; I < Reinclude.size(); ++I) {
     const auto *BB = Reinclude[I];
diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp 
b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index c5f9890018e26e..53350613b8f3ea 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -472,7 +472,7 @@ static const MDNode *getLeastCommonType(const MDNode *A, 
const MDNode *B) {
   SmallSetVector<const MDNode *, 4> PathA;
   TBAANode TA(A);
   while (TA.getNode()) {
-    if (!PathA.insert(TA.getNode()))
+    if (!PathA.insert(TA.getNode()).second)
       report_fatal_error("Cycle found in TBAA metadata.");
     TA = TA.getParent();
   }
@@ -480,7 +480,7 @@ static const MDNode *getLeastCommonType(const MDNode *A, 
const MDNode *B) {
   SmallSetVector<const MDNode *, 4> PathB;
   TBAANode TB(B);
   while (TB.getNode()) {
-    if (!PathB.insert(TB.getNode()))
+    if (!PathB.insert(TB.getNode()).second)
       report_fatal_error("Cycle found in TBAA metadata.");
     TB = TB.getParent();
   }
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp 
b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index 6a82db3ea6c6ec..982a309b2cb11b 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -4306,7 +4306,7 @@ void CombinerHelper::applyExtendThroughPhis(MachineInstr 
&MI,
     MachineInstr *SrcMI;
     if (!mi_match(SrcReg, MRI, m_MInstr(SrcMI)))
       continue;
-    if (!SrcMIs.insert(SrcMI))
+    if (!SrcMIs.insert(SrcMI).second)
       continue;
 
     // Build an extend after each src inst.
diff --git a/llvm/lib/CodeGen/MachineInstrBundle.cpp 
b/llvm/lib/CodeGen/MachineInstrBundle.cpp
index c6eeed3adcb405..2a27f18fa51376 100644
--- a/llvm/lib/CodeGen/MachineInstrBundle.cpp
+++ b/llvm/lib/CodeGen/MachineInstrBundle.cpp
@@ -173,7 +173,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
           DeadDefSet.insert(Reg);
         }
       } else {
-        if (ExternUses.insert(Reg)) {
+        if (ExternUses.insert(Reg).second) {
           if (MO.isUndef())
             UndefUseSet.insert(Reg);
         }
@@ -198,7 +198,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
       if (!Reg)
         continue;
 
-      if (LocalDefs.insert(Reg)) {
+      if (LocalDefs.insert(Reg).second) {
         if (!MO.isDead() && Reg.isPhysical()) {
           for (MCRegUnit Unit : TRI->regunits(Reg.asMCReg()))
             LocalDefsP.set(static_cast<unsigned>(Unit));
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c66190b8c1d31b..bf07a308dae302 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -28456,7 +28456,7 @@ static SDValue 
foldExtractSubvectorFromShuffleVector(EVT NarrowVT, SDValue Src,
     const std::pair<SDValue, int> DemandedSubvector =
         std::make_pair(Op, OpSubvecIdx);
 
-    if (DemandedSubvectors.insert(DemandedSubvector)) {
+    if (DemandedSubvectors.insert(DemandedSubvector).second) {
       if (DemandedSubvectors.size() > 2)
         return SDValue(); // We can't handle more than two subvectors.
       // How many elements into the WideVT does this subvector start?
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp 
b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index b7a9464c6661c8..76c1ec51ec6eeb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -455,7 +455,7 @@ lowerIncomingStatepointValue(SDValue Incoming, bool 
RequireSpillSlot,
                              SmallVectorImpl<SDValue> &Ops,
                              SmallVectorImpl<MachineMemOperand *> &MemRefs,
                              SelectionDAGBuilder &Builder) {
-  
+
   if (willLowerDirectly(Incoming)) {
     if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Incoming)) {
       // This handles allocas as arguments to the statepoint (this is only
@@ -473,7 +473,7 @@ lowerIncomingStatepointValue(SDValue Incoming, bool 
RequireSpillSlot,
     }
 
     assert(Incoming.getValueType().getSizeInBits() <= 64);
-    
+
     if (Incoming.isUndef()) {
       // Put an easily recognized constant that's unlikely to be a valid
       // value so that uses of undef by the consumer of the stackmap is
@@ -515,7 +515,7 @@ lowerIncomingStatepointValue(SDValue Incoming, bool 
RequireSpillSlot,
     // found by the runtime later.  Note: We know all of these spills are
     // independent, but don't bother to exploit that chain wise.  DAGCombine
     // will happily...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/232372
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to