[llvm] [LiveDebugValues] Avoid repeated hash lookups (NFC) (PR #110398)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 19:03:32 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that we must use insert_or_assign because operator[] would
require DbgValue to have the default constructor.
---
Full diff: https://github.com/llvm/llvm-project/pull/110398.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h (+2-6)
``````````diff
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 5c095e79599f6a..f157ffc6bcc2d7 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -1070,9 +1070,7 @@ class VLocTracker {
: DbgValue(Properties, DbgValue::Undef);
// Attempt insertion; overwrite if it's already mapped.
- auto Result = Vars.insert(std::make_pair(VarID, Rec));
- if (!Result.second)
- Result.first->second = Rec;
+ Vars.insert_or_assign(VarID, Rec);
Scopes[VarID] = MI.getDebugLoc().get();
considerOverlaps(Var, MI.getDebugLoc().get());
@@ -1100,9 +1098,7 @@ class VLocTracker {
DbgValue Rec = DbgValue(EmptyProperties, DbgValue::Undef);
// Attempt insertion; overwrite if it's already mapped.
- auto Result = Vars.insert(std::make_pair(OverlappedID, Rec));
- if (!Result.second)
- Result.first->second = Rec;
+ Vars.insert_or_assign(OverlappedID, Rec);
Scopes[OverlappedID] = Loc;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/110398
More information about the llvm-commits
mailing list