[llvm] [GVN] Use SmallDenseSet for visited node tracking (PR #215258)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 05:13:05 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Sven van Haastregt (svenvh)
<details>
<summary>Changes</summary>
Commit 0a321f38147f ("[GVN] Track visited nodes in equality propagation to avoid OOM (#<!-- -->212265)", 2026-08-05) caused some compilation time regressions. Use a SmallDenseSet to mitigate the impact of that change.
---
Full diff: https://github.com/llvm/llvm-project/pull/215258.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/GVN.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index a698b839b7f3a..64fd14fcba1c5 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -3092,7 +3092,7 @@ bool GVNPass::propagateEquality(
Value *LHS, Value *RHS,
const std::variant<BasicBlockEdge, Instruction *> &Root) {
SmallVector<std::pair<Value*, Value*>, 4> Worklist;
- DenseSet<std::pair<Value *, Value *>> Visited;
+ SmallDenseSet<std::pair<Value *, Value *>, 4> Visited;
Worklist.push_back(std::make_pair(LHS, RHS));
bool Changed = false;
SmallVector<const BasicBlock *> DominatedBlocks;
``````````
</details>
https://github.com/llvm/llvm-project/pull/215258
More information about the llvm-commits
mailing list