[llvm] 3c53d3a - [InlineCost] Use SmallPtrSet for DeadBlocks (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 28 06:26:29 PST 2022
Author: Nikita Popov
Date: 2022-02-28T15:26:22+01:00
New Revision: 3c53d3a7338f5c22dd17f9d196fce164c4161ec2
URL: https://github.com/llvm/llvm-project/commit/3c53d3a7338f5c22dd17f9d196fce164c4161ec2
DIFF: https://github.com/llvm/llvm-project/commit/3c53d3a7338f5c22dd17f9d196fce164c4161ec2.diff
LOG: [InlineCost] Use SmallPtrSet for DeadBlocks (NFC)
This set is only used with contains operations, so there is no
need to use a SetVector.
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 2a1a976226047..25cb242049df9 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -352,7 +352,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
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))
More information about the llvm-commits
mailing list