[llvm] [ADT][ProfileData] Introduce SortedVectorMap and switch CallTargetMap to it (PR #215733)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 14:58:30 PDT 2026


================
@@ -0,0 +1,91 @@
+//===- llvm/unittest/ADT/SortedVectorMapTest.cpp -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/SortedVectorMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "gtest/gtest.h"
+#include <string>
+
+using namespace llvm;
+
+namespace {
+
+TEST(SortedVectorMapTest, BasicOperations) {
+  SortedVectorMap<int, std::string> Map;
+
+  EXPECT_TRUE(Map.empty());
+  EXPECT_EQ(Map.size(), 0u);
+
+  Map[5] = "five";
+  Map[2] = "two";
+  Map[8] = "eight";
+
+  EXPECT_FALSE(Map.empty());
+  EXPECT_EQ(Map.size(), 3u);
----------------
kazutakahirata wrote:

Addressed in the latest iteration.

https://github.com/llvm/llvm-project/pull/215733


More information about the llvm-commits mailing list