Skip to content

Commit c38ef58

Browse files
[ByteCode] Avoid repeated hash lookups (NFC) (#132141)
1 parent 7193528 commit c38ef58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/ByteCode/Program.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
213213
if (auto Idx =
214214
createGlobal(VD, VD->getType(), IsStatic, IsExtern, IsWeak, Init)) {
215215
for (const Decl *P = VD; P; P = P->getPreviousDecl()) {
216+
unsigned &PIdx = GlobalIndices[P];
216217
if (P != VD) {
217-
unsigned PIdx = GlobalIndices[P];
218218
if (Globals[PIdx]->block()->isExtern())
219219
Globals[PIdx] = Globals[*Idx];
220220
}
221-
GlobalIndices[P] = *Idx;
221+
PIdx = *Idx;
222222
}
223223
return *Idx;
224224
}

0 commit comments

Comments
 (0)