Author: Kazu Hirata Date: 2025-03-20T09:09:57-07:00 New Revision: c38ef58557e26394e330f6ba16ff71b492cf50bb
URL: https://github.com/llvm/llvm-project/commit/c38ef58557e26394e330f6ba16ff71b492cf50bb DIFF: https://github.com/llvm/llvm-project/commit/c38ef58557e26394e330f6ba16ff71b492cf50bb.diff LOG: [ByteCode] Avoid repeated hash lookups (NFC) (#132141) Added: Modified: clang/lib/AST/ByteCode/Program.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp index c33d7fd7a2dc5..665e87bb5d2c8 100644 --- a/clang/lib/AST/ByteCode/Program.cpp +++ b/clang/lib/AST/ByteCode/Program.cpp @@ -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; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits