[llvm] [JumpThreading] Use SmallDenseSet (NFC) (PR #95674)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 15 10:56:45 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
The use of SmallDenseSet here saves 0.58% of heap allocations during
the compilation of a large preprocessed file, namely
X86ISelLowering.cpp, for the X86 target.
---
Full diff: https://github.com/llvm/llvm-project/pull/95674.diff
2 Files Affected:
- (modified) llvm/include/llvm/Transforms/Scalar/JumpThreading.h (+2-2)
- (modified) llvm/lib/Transforms/Scalar/JumpThreading.cpp (+1-1)
``````````diff
diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
index 65d43775bdc1d..1bf79fdcb697e 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);
+ SmallDenseSet<Value *> &RecursionSet, Instruction *CxtI = nullptr);
bool
computeValueKnownInPredecessors(Value *V, BasicBlock *BB,
jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
Instruction *CxtI = nullptr) {
- DenseSet<Value *> RecursionSet;
+ SmallDenseSet<Value *> 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..a4a04d5d16d4a 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, SmallDenseSet<Value *> &RecursionSet,
Instruction *CxtI) {
const DataLayout &DL = BB->getModule()->getDataLayout();
``````````
</details>
https://github.com/llvm/llvm-project/pull/95674
More information about the llvm-commits
mailing list