[ByteCode] Avoid repeated hash lookups (NFC) (#132141)

This commit is contained in:
Kazu Hirata 2025-03-20 09:09:57 -07:00 committed by GitHub
parent 71935281e0
commit c38ef58557
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -213,12 +213,12 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
if (auto Idx =
createGlobal(VD, VD->getType(), IsStatic, IsExtern, IsWeak, Init)) {
for (const Decl *P = VD; P; P = P->getPreviousDecl()) {
unsigned &PIdx = GlobalIndices[P];
if (P != VD) {
unsigned PIdx = GlobalIndices[P];
if (Globals[PIdx]->block()->isExtern())
Globals[PIdx] = Globals[*Idx];
}
GlobalIndices[P] = *Idx;
PIdx = *Idx;
}
return *Idx;
}