[llvm] 76af93f - Partially revert "[TableGen] Avoid repeated hash lookups (NFC) (#122586)"

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 23:51:04 PST 2025


Author: Kazu Hirata
Date: 2025-01-12T23:50:58-08:00
New Revision: 76af93fbea6c5f0f3558824ce8ebfafcf80a94d4

URL: https://github.com/llvm/llvm-project/commit/76af93fbea6c5f0f3558824ce8ebfafcf80a94d4
DIFF: https://github.com/llvm/llvm-project/commit/76af93fbea6c5f0f3558824ce8ebfafcf80a94d4.diff

LOG: Partially revert "[TableGen] Avoid repeated hash lookups (NFC) (#122586)"

This partially reverts commit 07ff786e39e2190449998d3af1000454dee501be.

The hunk being reverted in this patch seems to break:

  tools/llvm-gsymutil/ARM_AArch64/macho-merged-funcs-dwarf.yaml

under LLVM_ENABLE_EXPENSIVE_CHECKS.

Added: 
    

Modified: 
    llvm/utils/TableGen/Common/CodeGenSchedule.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index 7f4230affca09c..1fe322c88bb0fa 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -415,9 +415,9 @@ void CodeGenSchedModels::collectSTIPredicates() {
   for (const Record *R : Records.getAllDerivedDefinitions("STIPredicate")) {
     const Record *Decl = R->getValueAsDef("Declaration");
 
-    const auto [It, Inserted] =
-        Decl2Index.try_emplace(Decl, STIPredicates.size());
-    if (Inserted) {
+    const auto It = Decl2Index.find(Decl);
+    if (It == Decl2Index.end()) {
+      Decl2Index[Decl] = STIPredicates.size();
       STIPredicateFunction Predicate(Decl);
       Predicate.addDefinition(R);
       STIPredicates.emplace_back(std::move(Predicate));


        


More information about the llvm-commits mailing list