[llvm] f05b15b - [JumpThreading] Use SmallPtrSet (NFC) (#95674)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 15 13:59:43 PDT 2024
Author: Kazu Hirata
Date: 2024-06-15T13:59:40-07:00
New Revision: f05b15b21b46835efeb88eb8bfd456e82582722c
URL: https://github.com/llvm/llvm-project/commit/f05b15b21b46835efeb88eb8bfd456e82582722c
DIFF: https://github.com/llvm/llvm-project/commit/f05b15b21b46835efeb88eb8bfd456e82582722c.diff
LOG: [JumpThreading] Use SmallPtrSet (NFC) (#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.
Added:
Modified:
llvm/include/llvm/Transforms/Scalar/JumpThreading.h
llvm/lib/Transforms/Scalar/JumpThreading.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
index 65d43775bdc1d..a3f2ce23f7d9a 100644
--- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
+++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -130,13 +130,13 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
bool computeValueKnownInPredecessorsImpl(
Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
- DenseSet<Value *> &RecursionSet, Instruction *CxtI = nullptr);
+ SmallPtrSet<Value *, 4> &RecursionSet, Instruction *CxtI = nullptr);
bool
computeValueKnownInPredecessors(Value *V, BasicBlock *BB,
jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
Instruction *CxtI = nullptr) {
- DenseSet<Value *> RecursionSet;
+ SmallPtrSet<Value *, 4> RecursionSet;
return computeValueKnownInPredecessorsImpl(V, BB, Result, Preference,
RecursionSet, CxtI);
}
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index b9583836aea06..1aef2800e9846 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -558,7 +558,7 @@ static Constant *getKnownConstant(Value *Val, ConstantPreference Preference) {
/// This returns true if there were any known values.
bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
Value *V, BasicBlock *BB, PredValueInfo &Result,
- ConstantPreference Preference, DenseSet<Value *> &RecursionSet,
+ ConstantPreference Preference, SmallPtrSet<Value *, 4> &RecursionSet,
Instruction *CxtI) {
const DataLayout &DL = BB->getModule()->getDataLayout();
More information about the llvm-commits
mailing list