diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2024-09-30 23:15:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 23:15:18 +0100 |
commit | 96f37ae45310885e09195be09d9c05e1c1dff86b (patch) | |
tree | 88d65b1b72a39186ecc8eefadea9413cf7f02e6e /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 4980f2177e5c1b68afc8249c52523cc0a38ecf1c (diff) | |
download | llvm-96f37ae45310885e09195be09d9c05e1c1dff86b.zip llvm-96f37ae45310885e09195be09d9c05e1c1dff86b.tar.gz llvm-96f37ae45310885e09195be09d9c05e1c1dff86b.tar.bz2 |
[NFC] Use initial-stack-allocations for more data structures (#110544)
This replaces some of the most frequent offenders of using a DenseMap that
cause a malloc, where the typical element-count is small enough to fit in
an initial stack allocation.
Most of these are fairly obvious, one to highlight is the collectOffset
method of GEP instructions: if there's a GEP, of course it's going to have
at least one offset, but every time we've called collectOffset we end up
calling malloc as well for the DenseMap in the MapVector.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 7659fc6..cfe40f9 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -925,7 +925,7 @@ CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ, } using PredBlockVector = SmallVector<BasicBlock *, 16>; -using IncomingValueMap = DenseMap<BasicBlock *, Value *>; +using IncomingValueMap = SmallDenseMap<BasicBlock *, Value *, 16>; /// Determines the value to use as the phi node input for a block. /// @@ -2467,7 +2467,7 @@ Value *getSalvageOpsForGEP(GetElementPtrInst *GEP, const DataLayout &DL, SmallVectorImpl<Value *> &AdditionalValues) { unsigned BitWidth = DL.getIndexSizeInBits(GEP->getPointerAddressSpace()); // Rewrite a GEP into a DIExpression. - MapVector<Value *, APInt> VariableOffsets; + SmallMapVector<Value *, APInt, 4> VariableOffsets; APInt ConstantOffset(BitWidth, 0); if (!GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) return nullptr; |