Skip to content

Commit 2da8845

Browse files
committed
Update comments
1 parent 47823b9 commit 2da8845

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcxx/test/benchmarks/exception_ptr.bench.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static bool exception_ptr_moves_copies_swap(std::exception_ptr p1) {
3232
return is_null && is_equal;
3333
}
3434

35+
// Benchmark copies, moves and comparisons of a non-null exception_ptr.
3536
void bm_nonnull_exception_ptr(benchmark::State& state) {
3637
std::exception_ptr excptr = std::make_exception_ptr(42);
3738
for (auto _ : state) {
@@ -41,23 +42,22 @@ void bm_nonnull_exception_ptr(benchmark::State& state) {
4142
}
4243
BENCHMARK(bm_nonnull_exception_ptr);
4344

45+
// Benchmark copies, moves and comparisons of a nullptr exception_ptr
46+
// where the compiler cannot prove that the exception_ptr is always
47+
// a nullptr and needs to emit runtime checks.
4448
void bm_null_exception_ptr(benchmark::State& state) {
4549
std::exception_ptr excptr;
4650
for (auto _ : state) {
47-
// All of the `exception_ptr_noops` are no-ops but the optimizer
48-
// cannot optimize them away, because the `DoNotOptimize` calls
49-
// prevent the optimizer from doing so.
5051
benchmark::DoNotOptimize(excptr);
5152
benchmark::DoNotOptimize(exception_ptr_moves_copies_swap(excptr));
5253
}
5354
}
5455
BENCHMARK(bm_null_exception_ptr);
5556

57+
// Benchmark copies, moves and comparisons of a nullptr exception_ptr
58+
// where the compiler can proof that the exception_ptr is always a nullptr.
5659
void bm_optimized_null_exception_ptr(benchmark::State& state) {
5760
for (auto _ : state) {
58-
// All of the `exception_ptr_noops` are no-ops because
59-
// the exception_ptr is empty. Hence, the compiler should
60-
// be able to optimize them very aggressively.
6161
benchmark::DoNotOptimize(exception_ptr_moves_copies_swap(std::exception_ptr{nullptr}));
6262
}
6363
}

0 commit comments

Comments
 (0)