[llvm] [GenericDomTreeConstruction] Use SmallVector (NFC) (PR #96138)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 21:26:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

The use of SmallVector here saves 4.7% of heap allocations during the
compilation of ConvertExpr.cpp.ii, a preprocessed version of
flang/lib/Lower/ConvertExpr.cpp.

---
Full diff: https://github.com/llvm/llvm-project/pull/96138.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/GenericDomTreeConstruction.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 29b5f9159c68e..a216cd2a03596 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -72,7 +72,7 @@ struct SemiNCAInfo {
 
   // Number to node mapping is 1-based. Initialize the mapping to start with
   // a dummy element.
-  std::vector<NodePtr> NumToNode = {nullptr};
+  SmallVector<NodePtr, 64> NumToNode = {nullptr};
   DenseMap<NodePtr, InfoRec> NodeToInfo;
 
   using UpdateT = typename DomTreeT::UpdateType;

``````````

</details>


https://github.com/llvm/llvm-project/pull/96138


More information about the llvm-commits mailing list