Skip to content

Commit f05b15b

Browse files
[JumpThreading] Use SmallPtrSet (NFC) (llvm#95674)
The use of SmallPtrSet here saves 0.66% of heap allocations during the compilation of a large preprocessed file, namely X86ISelLowering.cpp, for the X86 target.
1 parent 7c0c9d6 commit f05b15b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/include/llvm/Transforms/Scalar/JumpThreading.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
130130
bool computeValueKnownInPredecessorsImpl(
131131
Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result,
132132
jumpthreading::ConstantPreference Preference,
133-
DenseSet<Value *> &RecursionSet, Instruction *CxtI = nullptr);
133+
SmallPtrSet<Value *, 4> &RecursionSet, Instruction *CxtI = nullptr);
134134
bool
135135
computeValueKnownInPredecessors(Value *V, BasicBlock *BB,
136136
jumpthreading::PredValueInfo &Result,
137137
jumpthreading::ConstantPreference Preference,
138138
Instruction *CxtI = nullptr) {
139-
DenseSet<Value *> RecursionSet;
139+
SmallPtrSet<Value *, 4> RecursionSet;
140140
return computeValueKnownInPredecessorsImpl(V, BB, Result, Preference,
141141
RecursionSet, CxtI);
142142
}

llvm/lib/Transforms/Scalar/JumpThreading.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static Constant *getKnownConstant(Value *Val, ConstantPreference Preference) {
558558
/// This returns true if there were any known values.
559559
bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
560560
Value *V, BasicBlock *BB, PredValueInfo &Result,
561-
ConstantPreference Preference, DenseSet<Value *> &RecursionSet,
561+
ConstantPreference Preference, SmallPtrSet<Value *, 4> &RecursionSet,
562562
Instruction *CxtI) {
563563
const DataLayout &DL = BB->getModule()->getDataLayout();
564564

0 commit comments

Comments
 (0)