Skip to content

Commit 412e10a

Browse files
kazutakahiratajph-13
authored andcommitted
[Transforms] Avoid repeated hash lookups (NFC) (llvm#130238)
1 parent af4e60c commit 412e10a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,8 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
785785
// fields confilicts with each other.
786786
unsigned UnknownTypeNum = 0;
787787
for (unsigned Index = 0; Index < FrameTy->getNumElements(); Index++) {
788-
if (!OffsetCache.contains(Index))
788+
auto OCIt = OffsetCache.find(Index);
789+
if (OCIt == OffsetCache.end())
789790
continue;
790791

791792
std::string Name;
@@ -797,8 +798,8 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
797798
Type *Ty = FrameTy->getElementType(Index);
798799
assert(Ty->isSized() && "We can't handle type which is not sized.\n");
799800
SizeInBits = Layout.getTypeSizeInBits(Ty).getFixedValue();
800-
AlignInBits = OffsetCache[Index].first * 8;
801-
OffsetInBits = OffsetCache[Index].second * 8;
801+
AlignInBits = OCIt->second.first * 8;
802+
OffsetInBits = OCIt->second.second * 8;
802803

803804
if (auto It = NameCache.find(Index); It != NameCache.end()) {
804805
Name = It->second.str();

0 commit comments

Comments
 (0)