diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2024-09-26 09:47:16 +0100 |
---|---|---|
committer | Jeremy Morse <jeremy.morse@sony.com> | 2024-09-26 10:49:29 +0100 |
commit | 056a3f4673a4f88d89e9bf00614355f671014ca5 (patch) | |
tree | 56154eb96746511dabe330939c159982dc730b98 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | d9250061e10b82f82d9833009f6565775578ee58 (diff) | |
download | llvm-056a3f4673a4f88d89e9bf00614355f671014ca5.zip llvm-056a3f4673a4f88d89e9bf00614355f671014ca5.tar.gz llvm-056a3f4673a4f88d89e9bf00614355f671014ca5.tar.bz2 |
[NFC] Reapply 3f37c517f, SmallDenseMap speedups
This time with 100% more building unit tests. Original commit message follows.
[NFC] Switch a number of DenseMaps to SmallDenseMaps for speedup (#109417)
If we use SmallDenseMaps instead of DenseMaps at these locations,
we get a substantial speedup because there's less spurious malloc
traffic. Discovered by instrumenting DenseMap with some accounting
code, then selecting sites where we'll get the most bang for our buck.
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 233f8ed..09e5c08 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2255,7 +2255,7 @@ const SCEV *ScalarEvolution::getAnyExtendExpr(const SCEV *Op, /// the common case where no interesting opportunities are present, and /// is also used as a check to avoid infinite recursion. static bool -CollectAddOperandsWithScales(DenseMap<const SCEV *, APInt> &M, +CollectAddOperandsWithScales(SmallDenseMap<const SCEV *, APInt, 16> &M, SmallVectorImpl<const SCEV *> &NewOps, APInt &AccumulatedConstant, ArrayRef<const SCEV *> Ops, const APInt &Scale, @@ -2753,7 +2753,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, // operands multiplied by constant values. if (Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx])) { uint64_t BitWidth = getTypeSizeInBits(Ty); - DenseMap<const SCEV *, APInt> M; + SmallDenseMap<const SCEV *, APInt, 16> M; SmallVector<const SCEV *, 8> NewOps; APInt AccumulatedConstant(BitWidth, 0); if (CollectAddOperandsWithScales(M, NewOps, AccumulatedConstant, |