[llvm] 1bb72f0 - [Object] Avoid repeated hash lookups (NFC) (#127746)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 08:21:13 PST 2025


Author: Kazu Hirata
Date: 2025-02-19T08:21:10-08:00
New Revision: 1bb72f0d7dd623e1c75dbe9e6a7f6b41f5284474

URL: https://github.com/llvm/llvm-project/commit/1bb72f0d7dd623e1c75dbe9e6a7f6b41f5284474
DIFF: https://github.com/llvm/llvm-project/commit/1bb72f0d7dd623e1c75dbe9e6a7f6b41f5284474.diff

LOG: [Object] Avoid repeated hash lookups (NFC) (#127746)

Added: 
    

Modified: 
    llvm/lib/Object/GOFFObjectFile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/GOFFObjectFile.cpp b/llvm/lib/Object/GOFFObjectFile.cpp
index 7806953aecd29..a55005e689e62 100644
--- a/llvm/lib/Object/GOFFObjectFile.cpp
+++ b/llvm/lib/Object/GOFFObjectFile.cpp
@@ -503,8 +503,9 @@ GOFFObjectFile::getSectionContents(DataRefImpl Sec) const {
     std::copy(CompleteData.data(), CompleteData.data() + TxtDataSize,
               Data.begin() + TxtDataOffset);
   }
-  SectionDataCache[Sec.d.a] = Data;
-  return ArrayRef<uint8_t>(SectionDataCache[Sec.d.a]);
+  auto &Cache = SectionDataCache[Sec.d.a];
+  Cache = Data;
+  return ArrayRef<uint8_t>(Cache);
 }
 
 uint64_t GOFFObjectFile::getSectionAlignment(DataRefImpl Sec) const {


        


More information about the llvm-commits mailing list