Files
carbon-lang/common/hashtable_key_context_test.cpp
T
Chandler Carruth 4729b4473b Provide optimized string equality for hashtable keys (#8143)
We shouldn't need to do this, and we should be able to rely on LLVM's
`StringRef::operator==` and similar routines to be efficient. But in
practice and after measuring, this seems to not be the case. =/

Both glibc and LLVM-libc have `bcmp` implementations significantly
slower than what we introduce here, and reaching into libc requires PLT
overhead and other challenges. I plan to send a PR to LLVM-libc of this
implementation to replace its `bcmp`. Until that lands and we can
reliably use it, having this makes a _dramatic_ impact on hashtable
performance for string keys, which happens to be the case we care very
much about in the compiler.

This implementation is somewhat based on the premise that hashtable keys
and other kinds of string comparisons are close enough in their expected
behavior and distribution of data sizes that we don't need to overly
specialize. We have data suggesting that _all_ string comparisons are
heavily biased towards short strings and latency-sensitive code paths,
much as hashtable keys are. This implementation specifically optimizes
for those two priorities: latency and short strings.

The overarching design of this string comparison has a few key ideas
that enable it to be efficient:

- Must be an efficient out-of-line function to allow callers to remain
good inline candidates. Also uses `preserve_most` to minimize register
pressure in the caller, and `pure` to avoid re-loading values from
memory.
- Avoid trying to pass `bool`, a defined `0` vs `1` value, or condition
flags across this out-of-line ABI boundary as they are not efficiently
represented and converting to these representations within the
implementation adds overhead. We want the caller to be able to have the
conditional branch that converts to a boolean state where it can be
fused and efficient. The out-of-line function needs to return an
efficient input to a caller's conditional branch. This motivates a
`uint64_t` result type which has the most flexibility for the
implementation.
- Overread for sizes up to 8 bytes when within the page -- we read 8
bytes and then mask off the bits that we were not allowed to read. This
has to be disabled when using sanitizers and we only support
little-endian masking, but is a _significant_ performance improvement
when available.
- Overlapping reads at the start and end: much like in hashing,
_duplicate_ reads are fine, and we can leverage this to handle a range
of sizes with common code, for example reading the first and last 8
bytes handles sizes 9 through 16 with identical code.
- Balance between branch-predictable returns of constants and returning
a computed non-zero value (via xor or other operation) for the caller to
branch on. Sometimes, it is useful to allow branch prediction to
early-exit the comparisons, other times it ends up better to compute the
data and let the caller's branch be predicted or not.
- Use relevant architecture and microarchitecture details when needed.
For example, we carefully select between vector operations and GPR
operations to minimize vector <-> GPR movement overhead.

The PR provides unit tests for the relevant size classes and various
boundary conditions.

We also provide benchmarks, both ones that measure _latency_ of the
comparison by causing each iteration to have a data dependency on the
prior iteration, and ones that measure _throughput_ by allowing each
iteration to run in parallel. Even though we optimize for latency first,
we want to have the best throughput we can.

Cycles per comparison (lower is better) vs. Linux glibc ("System") and
out-of-line LLVM-libc `inline_bcmp` ("LLVM"). "C++ ids" uses the C++
identifier length distribution. `System` and `LLVM` are relative to this
implementation: positive `%` and `>1x` mean this implementation is
faster; negative `%` and `<1x` mean it is slower; `~` is no significant
difference (p < 0.05).

AArch64 (armv8.2-a) on an Apple M1 P-core, cycles per comparison:

| Sizes    | Latency | System |   LLVM | Throughput | System |   LLVM |
| :------- | ------: | -----: | -----: | ---------: | -----: | -----: |
| C++ ids  |    21.3 |   +41% |   +40% |       12.5 |   +93% |  +100% |
| 1-3      |    14.4 |   +48% |   +64% |        5.0 |  3.99x |  3.83x |
| 4-8      |    14.5 |   +55% |   +46% |        5.0 |  2.30x |  3.02x |
| 9-16     |    14.6 |   +47% |   +29% |        4.0 |  2.22x |   +95% |
| 17-32    |    17.6 |   +20% |   +50% |        5.2 |   +38% |   -21% |
| 33-64    |    20.1 |   +40% |   +47% |        7.2 |  2.68x |   -16% |
| 65-256   |    36.9 |   +49% |   +17% |       30.0 |   +57% |    -3% |
| 257-1024 |   103.8 |   +38% |    +7% |       85.1 |   +58% |  +0.2% |

x86-64-v3 on an AMD Ryzen 9 9950X (Zen 5), cycles per comparison:

| Sizes    | Latency | System |   LLVM | Throughput | System |   LLVM |
| :------- | ------: | -----: | -----: | ---------: | -----: | -----: |
| C++ ids  |    24.0 |    +1% |   +75% |       18.1 |  0.39x |  2.36x |
| 1-3      |    14.4 |   +57% |  2.34x |        4.7 |    +7% |  7.24x |
| 4-8      |    14.4 |   +57% |  2.62x |        4.7 |    +7% |  8.36x |
| 9-16     |    15.0 |   +53% |    +5% |        5.9 |   -15% |      ~ |
| 17-32    |    22.8 |  +0.4% |   +10% |        7.0 |   -29% |   -21% |
| 33-64    |    25.8 |    -6% |    +6% |        7.1 |   -16% |    -5% |
| 65-256   |    45.1 |    +4% |   +25% |       28.3 |    -7% |   +50% |
| 257-1024 |    64.0 |   +17% |   +35% |       64.7 |   +10% |   +16% |

x86-64-v3 on an AMD EPYC 7B13 (Zen 3), cycles per comparison:

| Sizes    | Latency | System |   LLVM | Throughput | System |   LLVM |
| :------- | ------: | -----: | -----: | ---------: | -----: | -----: |
| C++ ids  |    24.1 |    N/A |   +54% |       16.9 |    +8% |  2.15x |
| 1-3      |    15.6 |    N/A |   +94% |        5.7 |  4.29x |  5.04x |
| 4-8      |    15.6 |    N/A |  2.12x |        5.7 |  2.56x |  5.87x |
| 9-16     |    15.8 |    N/A |   +11% |        7.1 |  2.03x |      ~ |
| 17-32    |    24.6 |    N/A |  +0.4% |        8.1 |   +74% |   -12% |
| 33-64    |    30.5 |    -6% |    -1% |       10.1 |    +9% |   -10% |
| 65-256   |    46.3 |   +12% |   +32% |       33.2 |    -8% |   +39% |
| 257-1024 |    78.8 |   +12% |   +26% |       82.3 |    -3% |      ~ |

x86-64-v2 on an AMD Ryzen 9 9950X (Zen 5), cycles per comparison:

| Sizes    | Latency | System |   LLVM | Throughput | System |   LLVM |
| :------- | ------: | -----: | -----: | ---------: | -----: | -----: |
| C++ ids  |    23.9 |    +2% |   +78% |       17.7 |  0.40x |  2.45x |
| 1-3      |    14.8 |   +53% |  2.28x |        5.0 |      ~ |  6.68x |
| 4-8      |    14.9 |   +55% |  2.54x |        5.0 |      ~ |  7.82x |
| 9-16     |    14.9 |   +53% |    +5% |        6.0 |   -17% |   -17% |
| 17-32    |    22.7 |  +0.4% |   +10% |        6.0 |   -17% |      ~ |
| 33-64    |    26.9 |   -10% |   +37% |        7.5 |   -20% |  3.35x |
| 65-256   |    47.7 |    -1% |   +20% |       38.2 |   -31% |   +30% |
| 257-1024 |    91.5 |   -18% |   +24% |       91.4 |   -22% |   +18% |

x86-64-v2 on an AMD EPYC 7B13 (Zen 3), cycles per comparison:

| Sizes    | Latency | System |   LLVM | Throughput | System |   LLVM |
| :------- | ------: | -----: | -----: | ---------: | -----: | -----: |
| C++ ids  |    24.1 |    N/A |   +55% |       16.5 |   +10% |  2.24x |
| 1-3      |    15.8 |    N/A |   +92% |        6.3 |  3.88x |  4.60x |
| 4-8      |    15.8 |    N/A |  2.10x |        6.3 |  2.32x |  5.34x |
| 9-16     |    15.8 |    N/A |   +11% |        7.1 |  2.03x |      ~ |
| 17-32    |    24.4 |    N/A |    +4% |        8.1 |   +74% |      ~ |
| 33-64    |    30.7 |    -7% |   +26% |       10.0 |   +11% |  2.70x |
| 65-256   |    48.5 |    +7% |   +31% |       45.8 |   -33% |   +19% |
| 257-1024 |   108.1 |   -21% |   +11% |      110.9 |   -29% |      ~ |

Note: Zen 3 `System` latency is `N/A` for `C++ ids` and 1-32 bytes
because glibc's AVX2 `memcmp` returns a constant `0` behind a predicted
branch for equal 2-31 byte strings, so the latency benchmark's select
doesn't wait on the comparison.

Assisted-by: Antigravity with Gemini, Fable, and other models
2026-11-21 22:35:59 +00:00

338 lines
13 KiB
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "common/hashtable_key_context.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <memory>
#include <string>
#include "common/hashing_llvm.h"
#if __has_include(<sys/mman.h>)
#include <sys/mman.h>
#include <unistd.h>
#endif
namespace Carbon {
namespace {
using ::testing::Eq;
using ::testing::Ne;
struct DefaultEq {
int x, y;
friend auto operator==(const DefaultEq& lhs, const DefaultEq& rhs)
-> bool = default;
};
struct CustomEq {
int x, y;
friend auto operator==(const CustomEq& lhs, const CustomEq& rhs) -> bool {
return lhs.x == rhs.x && lhs.y == rhs.y;
}
};
struct CustomExtEq {
int x, y;
friend auto CarbonHashtableEq(const CustomExtEq& lhs, const CustomExtEq& rhs)
-> bool {
return lhs.x == rhs.x && lhs.y == rhs.y;
}
};
TEST(HashtableKeyContextTest, HashtableEq) {
EXPECT_TRUE(HashtableEq(0, 0));
EXPECT_FALSE(HashtableEq(1, 0));
EXPECT_FALSE(HashtableEq(0, 1));
EXPECT_FALSE(HashtableEq(1234, 5678));
EXPECT_TRUE(HashtableEq(5678, 5678));
EXPECT_TRUE(
HashtableEq(DefaultEq{.x = 0, .y = 0}, DefaultEq{.x = 0, .y = 0}));
EXPECT_FALSE(
HashtableEq(DefaultEq{.x = 1, .y = 2}, DefaultEq{.x = 3, .y = 4}));
EXPECT_TRUE(HashtableEq(CustomEq{.x = 0, .y = 0}, CustomEq{.x = 0, .y = 0}));
EXPECT_FALSE(HashtableEq(CustomEq{.x = 1, .y = 2}, CustomEq{.x = 3, .y = 4}));
EXPECT_TRUE(
HashtableEq(CustomExtEq{.x = 0, .y = 0}, CustomExtEq{.x = 0, .y = 0}));
EXPECT_FALSE(
HashtableEq(CustomExtEq{.x = 1, .y = 2}, CustomExtEq{.x = 3, .y = 4}));
}
TEST(HashtableKeyContextTest, HashtableEqStrings) {
EXPECT_TRUE(HashtableEq(llvm::StringRef(), llvm::StringRef("")));
EXPECT_TRUE(HashtableEq(llvm::StringRef("abc"), std::string("abc")));
EXPECT_TRUE(HashtableEq(std::string("abc"), llvm::StringRef("abc")));
EXPECT_TRUE(HashtableEq(std::string("abc"), std::string("abc")));
EXPECT_FALSE(HashtableEq(llvm::StringRef("abc"), llvm::StringRef("abcd")));
EXPECT_FALSE(HashtableEq(std::string("abc"), std::string("abz")));
for (size_t size = 0; size <= 600; ++size) {
// Offsetting `lhs` in its allocation covers each of its alignments, which
// larger sizes depend on. Each string ends its allocation, so ASan catches
// any read past its end, and any read before its start with no offset.
for (size_t offset = 0; offset < 32; ++offset) {
auto lhs_storage = std::make_unique<char[]>(offset + size);
auto rhs_storage = std::make_unique<char[]>(size);
char* lhs = lhs_storage.get() + offset;
char* rhs = rhs_storage.get();
for (size_t i = 0; i < size; ++i) {
lhs[i] = rhs[i] = static_cast<char>('a' + i % 26);
}
llvm::StringRef lhs_ref(lhs, size);
llvm::StringRef rhs_ref(rhs, size);
EXPECT_TRUE(HashtableEq(lhs_ref, rhs_ref))
<< "size=" << size << " offset=" << offset;
for (size_t i = 0; i < size; ++i) {
rhs[i] ^= 1;
EXPECT_FALSE(HashtableEq(lhs_ref, rhs_ref))
<< "size=" << size << " offset=" << offset << " i=" << i;
rhs[i] ^= 1;
}
}
}
}
// Short strings can be compared by reading past their ends, so check that the
// bytes that follow them don't affect the result.
TEST(HashtableKeyContextTest, HashtableEqStringsIgnoresFollowingBytes) {
for (size_t size = 0; size <= 32; ++size) {
std::string str(size, 'a');
// Equal strings, followed by bytes that all differ.
std::string lhs = str + std::string(64, 'x');
std::string rhs = str + std::string(64, 'y');
EXPECT_TRUE(HashtableEq(llvm::StringRef(lhs.data(), size),
llvm::StringRef(rhs.data(), size)))
<< "size=" << size;
if (size == 0) {
continue;
}
// Strings that differ in their last byte, followed by the same bytes.
rhs = lhs;
rhs[size - 1] = 'b';
EXPECT_FALSE(HashtableEq(llvm::StringRef(lhs.data(), size),
llvm::StringRef(rhs.data(), size)))
<< "size=" << size;
}
}
#if __has_include(<sys/mman.h>)
// Compares strings next to inaccessible pages, so that reading anything outside
// the pages that hold their bytes faults.
TEST(HashtableKeyContextTest, HashtableEqStringsNextToInaccessiblePages) {
auto page = static_cast<size_t>(sysconf(_SC_PAGESIZE));
void* mapping = mmap(nullptr, 3 * page, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ASSERT_NE(mapping, MAP_FAILED);
// Only the middle page is accessible.
char* begin = static_cast<char*>(mapping) + page;
char* end = begin + page;
ASSERT_EQ(mprotect(begin - page, page, PROT_NONE), 0);
ASSERT_EQ(mprotect(end, page, PROT_NONE), 0);
// Comparing empty strings can't read anything, even through dangling
// pointers.
const char* inaccessible[] = {begin - page,
begin - 1,
end,
end + page - 1,
reinterpret_cast<const char*>(1),
reinterpret_cast<const char*>(8)};
for (const char* data : inaccessible) {
EXPECT_TRUE(HashtableEq(llvm::StringRef(data, 0), llvm::StringRef()));
EXPECT_TRUE(
HashtableEq(llvm::StringRef(begin, 0), llvm::StringRef(data, 0)));
EXPECT_TRUE(HashtableEq(llvm::StringRef(data, 0), llvm::StringRef(end, 0)));
}
// Compare a string that starts a little after the first inaccessible page
// with one that ends a little before the last.
for (size_t size = 1; size <= 64; ++size) {
for (size_t offset = 0; offset < 16; ++offset) {
char* lhs = begin + offset;
char* rhs = end - offset - size;
for (size_t i = 0; i < size; ++i) {
lhs[i] = rhs[i] = static_cast<char>('a' + i % 26);
}
llvm::StringRef lhs_ref(lhs, size);
llvm::StringRef rhs_ref(rhs, size);
EXPECT_TRUE(HashtableEq(lhs_ref, rhs_ref))
<< "size=" << size << " offset=" << offset;
EXPECT_TRUE(HashtableEq(rhs_ref, lhs_ref))
<< "size=" << size << " offset=" << offset;
for (size_t i = 0; i < size; ++i) {
rhs[i] ^= 1;
EXPECT_FALSE(HashtableEq(lhs_ref, rhs_ref))
<< "size=" << size << " offset=" << offset << " i=" << i;
EXPECT_FALSE(HashtableEq(rhs_ref, lhs_ref))
<< "size=" << size << " offset=" << offset << " i=" << i;
rhs[i] ^= 1;
}
}
}
ASSERT_EQ(munmap(mapping, 3 * page), 0);
}
#endif
TEST(HashtableKeyContextTest, HashtableEqAPInt) {
// Hashtable equality doesn't assert on mismatched bit width, it includes the
// bit width in the comparison.
llvm::APInt one_64(/*numBits=*/64, /*val=*/1);
llvm::APInt two_64(/*numBits=*/64, /*val=*/2);
llvm::APInt one_128(/*numBits=*/128, /*val=*/1);
llvm::APInt two_128(/*numBits=*/128, /*val=*/2);
EXPECT_TRUE(HashtableEq(one_64, one_64));
EXPECT_FALSE(HashtableEq(one_64, one_128));
EXPECT_TRUE(HashtableEq(two_128, two_128));
EXPECT_FALSE(HashtableEq(two_64, two_128));
EXPECT_FALSE(HashtableEq(one_64, two_64));
EXPECT_FALSE(HashtableEq(one_64, two_128));
EXPECT_FALSE(HashtableEq(one_128, two_128));
EXPECT_FALSE(HashtableEq(one_128, two_64));
}
TEST(HashtableKeyContextTest, HashtableEqAPFloat) {
// Hashtable equality for `APFloat` uses a bitwise comparison. This
// differentiates between various things that would otherwise not make sense:
// - Different floating point semantics
// - `-0.0` and `0.0`
//
// It also allows NaNs to be compared meaningfully.
llvm::APFloat zero_float =
llvm::APFloat::getZero(llvm::APFloat::IEEEsingle());
llvm::APFloat neg_zero_float =
llvm::APFloat::getZero(llvm::APFloat::IEEEsingle(), /*Negative=*/true);
llvm::APFloat zero_double =
llvm::APFloat::getZero(llvm::APFloat::IEEEdouble());
llvm::APFloat zero_bfloat = llvm::APFloat::getZero(llvm::APFloat::BFloat());
llvm::APFloat one_float = llvm::APFloat::getOne(llvm::APFloat::IEEEsingle());
llvm::APFloat inf_float = llvm::APFloat::getInf(llvm::APFloat::IEEEsingle());
llvm::APFloat nan_0_float = llvm::APFloat::getNaN(
llvm::APFloat::IEEEsingle(), /*Negative=*/false, /*payload=*/0);
llvm::APFloat nan_42_float = llvm::APFloat::getNaN(
llvm::APFloat::IEEEsingle(), /*Negative=*/false, /*payload=*/42);
// Boring cases.
EXPECT_TRUE(HashtableEq(zero_float, zero_float));
EXPECT_FALSE(HashtableEq(zero_float, one_float));
EXPECT_TRUE(HashtableEq(inf_float, inf_float));
EXPECT_FALSE(HashtableEq(inf_float, one_float));
// Confirm a case where we expect `==` to work but produce a different result.
ASSERT_TRUE(zero_float == neg_zero_float);
EXPECT_FALSE(HashtableEq(zero_float, neg_zero_float));
// Now work through less reasonable things outside of a hashtable such as
// mixing semantics and NaNs.
EXPECT_FALSE(HashtableEq(zero_float, zero_double));
EXPECT_FALSE(HashtableEq(zero_float, zero_bfloat));
EXPECT_FALSE(HashtableEq(zero_float, nan_0_float));
EXPECT_FALSE(HashtableEq(zero_float, nan_42_float));
EXPECT_FALSE(HashtableEq(nan_0_float, nan_42_float));
}
struct CustomHash {
int x;
friend auto CarbonHashValue(const CustomHash& value) -> HashCode {
return HashValue(value.x + 42);
}
};
TEST(HashtableKeyContextTest, DefaultKeyContext) {
// Make sure the default context dispatches appropriately, including for
// interesting types. We don't cover all the cases here and use the direct
// tests of `HashtableEq` for that.
DefaultKeyContext context;
EXPECT_FALSE(context.KeyEq(1234, 5678));
EXPECT_TRUE(context.KeyEq(5678, 5678));
EXPECT_TRUE(context.KeyEq(DefaultEq{0, 0}, DefaultEq{0, 0}));
EXPECT_FALSE(context.KeyEq(DefaultEq{1, 2}, DefaultEq{3, 4}));
EXPECT_TRUE(context.KeyEq(CustomEq{0, 0}, CustomEq{0, 0}));
EXPECT_FALSE(context.KeyEq(CustomEq{1, 2}, CustomEq{3, 4}));
EXPECT_TRUE(context.KeyEq(CustomExtEq{0, 0}, CustomExtEq{0, 0}));
EXPECT_FALSE(context.KeyEq(CustomExtEq{1, 2}, CustomExtEq{3, 4}));
llvm::APInt one_64(/*numBits=*/64, /*val=*/1);
llvm::APInt one_128(/*numBits=*/128, /*val=*/1);
EXPECT_TRUE(HashtableEq(one_64, one_64));
EXPECT_FALSE(HashtableEq(one_64, one_128));
llvm::APFloat zero_float =
llvm::APFloat::getZero(llvm::APFloat::IEEEsingle());
llvm::APFloat neg_zero_float =
llvm::APFloat::getZero(llvm::APFloat::IEEEsingle(), /*Negative=*/true);
EXPECT_TRUE(HashtableEq(zero_float, zero_float));
EXPECT_FALSE(HashtableEq(zero_float, neg_zero_float));
// Also check hash dispatching.
EXPECT_THAT(context.HashKey(42), Eq(HashValue(42)));
EXPECT_THAT(context.HashKey(CustomHash{.x = 1234}),
Eq(HashValue(CustomHash{.x = 1234})));
EXPECT_THAT(context.HashKey(one_64), Eq(HashValue(one_64)));
EXPECT_THAT(context.HashKey(one_128), Eq(HashValue(one_128)));
EXPECT_THAT(context.HashKey(one_64), Ne(context.HashKey(one_128)));
EXPECT_THAT(context.HashKey(zero_float), Eq(HashValue(zero_float)));
EXPECT_THAT(context.HashKey(neg_zero_float), Eq(HashValue(neg_zero_float)));
EXPECT_THAT(context.HashKey(zero_float), Ne(context.HashKey(neg_zero_float)));
}
struct TestTranslatingKeyContext
: TranslatingKeyContext<TestTranslatingKeyContext> {
auto TranslateKey(int index) const -> const llvm::APInt& {
return array[index];
}
llvm::ArrayRef<llvm::APInt> array;
};
TEST(HashtableKeyContextTest, TranslatingKeyContext) {
llvm::APInt one_64(/*numBits=*/64, /*val=*/1);
llvm::APInt two_64(/*numBits=*/64, /*val=*/2);
llvm::APInt one_128(/*numBits=*/128, /*val=*/1);
llvm::APInt two_128(/*numBits=*/128, /*val=*/2);
// An array of values, including some duplicates.
llvm::SmallVector<llvm::APInt> values = {one_64, two_64, one_128,
two_128, one_64, one_64};
TestTranslatingKeyContext context = {.array = values};
EXPECT_THAT(context.HashKey(0), Eq(HashValue(one_64)));
EXPECT_THAT(context.HashKey(1), Eq(HashValue(two_64)));
EXPECT_THAT(context.HashKey(2), Eq(HashValue(one_128)));
EXPECT_THAT(context.HashKey(3), Eq(HashValue(two_128)));
EXPECT_THAT(context.HashKey(4), Eq(HashValue(one_64)));
EXPECT_THAT(context.HashKey(5), Eq(HashValue(one_64)));
EXPECT_TRUE(context.KeyEq(one_64, 0));
EXPECT_TRUE(context.KeyEq(one_64, 4));
EXPECT_TRUE(context.KeyEq(one_64, 5));
EXPECT_TRUE(context.KeyEq(0, one_64));
EXPECT_TRUE(context.KeyEq(0, 0));
EXPECT_TRUE(context.KeyEq(0, 4));
EXPECT_TRUE(context.KeyEq(4, 5));
EXPECT_FALSE(context.KeyEq(one_64, 1));
EXPECT_FALSE(context.KeyEq(one_64, 2));
EXPECT_FALSE(context.KeyEq(one_64, 3));
EXPECT_FALSE(context.KeyEq(1, one_64));
EXPECT_FALSE(context.KeyEq(2, one_64));
EXPECT_FALSE(context.KeyEq(3, one_64));
EXPECT_FALSE(context.KeyEq(0, 1));
EXPECT_FALSE(context.KeyEq(0, 2));
EXPECT_FALSE(context.KeyEq(4, 3));
}
} // namespace
} // namespace Carbon