diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2024-09-25 14:22:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 14:22:23 +0100 |
commit | 3f37c517fbc40531571f8b9f951a8610b4789cd6 (patch) | |
tree | 872cceb264a905e0a8ef3220b2a93fb084357317 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 4be1c19a9fbdff02044cd46b703c842bb7a6afdb (diff) | |
download | llvm-3f37c517fbc40531571f8b9f951a8610b4789cd6.zip llvm-3f37c517fbc40531571f8b9f951a8610b4789cd6.tar.gz llvm-3f37c517fbc40531571f8b9f951a8610b4789cd6.tar.bz2 |
[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/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 4144c79..7bffd4d 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -503,7 +503,8 @@ static bool removeRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) { static bool DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { SmallVector<DbgVariableRecord *, 8> ToBeRemoved; - DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>> + SmallDenseMap<DebugVariable, + std::pair<SmallVector<Value *, 4>, DIExpression *>, 4> VariableMap; for (auto &I : *BB) { for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) { @@ -584,7 +585,8 @@ static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { return DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BB); SmallVector<DbgValueInst *, 8> ToBeRemoved; - DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>> + SmallDenseMap<DebugVariable, + std::pair<SmallVector<Value *, 4>, DIExpression *>, 4> VariableMap; for (auto &I : *BB) { if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) { |