[InlineCost] Use SmallPtrSet for DeadBlocks (NFC)
authorNikita Popov <npopov@redhat.com>
Mon, 28 Feb 2022 14:25:03 +0000 (15:25 +0100)
committerNikita Popov <npopov@redhat.com>
Mon, 28 Feb 2022 14:26:22 +0000 (15:26 +0100)
This set is only used with contains operations, so there is no
need to use a SetVector.

llvm/lib/Analysis/InlineCost.cpp

index 2a1a976..25cb242 100644 (file)
@@ -352,7 +352,7 @@ protected:
   DenseMap<Value *, std::pair<Value *, APInt>> ConstantOffsetPtrs;
 
   /// Keep track of dead blocks due to the constant arguments.
-  SetVector<BasicBlock *> DeadBlocks;
+  SmallPtrSet<BasicBlock *, 16> DeadBlocks;
 
   /// The mapping of the blocks to their known unique successors due to the
   /// constant arguments.
@@ -2552,7 +2552,7 @@ void CallAnalyzer::findDeadBlocks(BasicBlock *CurrBB, BasicBlock *NextBB) {
     NewDead.push_back(Succ);
     while (!NewDead.empty()) {
       BasicBlock *Dead = NewDead.pop_back_val();
-      if (DeadBlocks.insert(Dead))
+      if (DeadBlocks.insert(Dead).second)
         // Continue growing the dead block lists.
         for (BasicBlock *S : successors(Dead))
           if (IsNewlyDead(S))