Skip to content

Commit 2acec3e

Browse files
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#111937)
1 parent 8a53dc6 commit 2acec3e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,10 @@ Error EHFrameEdgeFixer::processBlock(ParseContext &PC, Block &B) {
136136
// Otherwise check if we previously had exactly one relocation at this
137137
// offset. If so, we now have a second one and move it from the TargetMap
138138
// into the Multiple set.
139-
auto It = BlockEdges.TargetMap.find(E.getOffset());
140-
if (It != BlockEdges.TargetMap.end()) {
139+
auto [It, Inserted] = BlockEdges.TargetMap.try_emplace(E.getOffset(), E);
140+
if (!Inserted) {
141141
BlockEdges.TargetMap.erase(It);
142142
BlockEdges.Multiple.insert(E.getOffset());
143-
} else {
144-
BlockEdges.TargetMap[E.getOffset()] = EdgeTarget(E);
145143
}
146144
}
147145

0 commit comments

Comments
 (0)