[llvm] Fix assert for [CGData] Outlined Hash Tree #89792 (PR #98383)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 14:09:58 PDT 2024


https://github.com/kyulee-com updated https://github.com/llvm/llvm-project/pull/98383

>From e23f47571229b631b84b3aeae3e3cacfd42e1431 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Wed, 10 Jul 2024 13:41:59 -0700
Subject: [PATCH 1/3] Fix assert for [CGData] Outlined Hash Tree #89792

---
 llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
index 996a57fd5e713..473d69e011e9a 100644
--- a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
+++ b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
@@ -119,7 +119,7 @@ void OutlinedHashTreeRecord::convertToStableData(
       [&NodeIdMap](const HashNode *Current) {
         size_t Index = NodeIdMap.size();
         NodeIdMap[Current] = Index;
-        assert(Index = NodeIdMap.size() + 1 &&
+        assert(Index + 1 == NodeIdMap.size() &&
                        "Expected size of NodeMap to increment by 1");
       },
       /*EdgeCallbackFn=*/nullptr, /*SortedWork=*/true);

>From 92258c583f65b90bb11e9f557bed0f18bcac4e60 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Wed, 10 Jul 2024 13:50:37 -0700
Subject: [PATCH 2/3] fix format

---
 llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
index 473d69e011e9a..72911f5da396e 100644
--- a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
+++ b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
@@ -120,7 +120,7 @@ void OutlinedHashTreeRecord::convertToStableData(
         size_t Index = NodeIdMap.size();
         NodeIdMap[Current] = Index;
         assert(Index + 1 == NodeIdMap.size() &&
-                       "Expected size of NodeMap to increment by 1");
+               "Expected size of NodeMap to increment by 1");
       },
       /*EdgeCallbackFn=*/nullptr, /*SortedWork=*/true);
 

>From 723734f1d9f9f9997980ed7a94f5ef7152093d12 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Wed, 10 Jul 2024 14:09:38 -0700
Subject: [PATCH 3/3] address feedback from alx32

---
 llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
index 72911f5da396e..d3c6790408388 100644
--- a/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
+++ b/llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp
@@ -119,8 +119,8 @@ void OutlinedHashTreeRecord::convertToStableData(
       [&NodeIdMap](const HashNode *Current) {
         size_t Index = NodeIdMap.size();
         NodeIdMap[Current] = Index;
-        assert(Index + 1 == NodeIdMap.size() &&
-               "Expected size of NodeMap to increment by 1");
+        assert((Index + 1 == NodeIdMap.size()) &&
+               "Duplicate key in NodeIdMap: 'Current' should be unique.");
       },
       /*EdgeCallbackFn=*/nullptr, /*SortedWork=*/true);
 



More information about the llvm-commits mailing list