@@ -30,9 +30,9 @@ void bm_exception_ptr_copy_ctor_null(benchmark::State& state) {
3030 std::exception_ptr excptr = nullptr ;
3131 for (auto _ : state) {
3232 std::exception_ptr excptr_copy (excptr);
33- benchmark::DoNotOptimize (excptr_copy);
3433 // The compiler should be able to constant-fold the comparison
3534 benchmark::DoNotOptimize (excptr_copy == nullptr );
35+ benchmark::DoNotOptimize (excptr_copy);
3636 }
3737}
3838BENCHMARK (bm_exception_ptr_copy_ctor_null);
@@ -52,9 +52,9 @@ void bm_exception_ptr_move_ctor_null(benchmark::State& state) {
5252 std::exception_ptr excptr = nullptr ;
5353 for (auto _ : state) {
5454 std::exception_ptr new_excptr (std::move (excptr));
55- benchmark::DoNotOptimize (new_excptr);
5655 // The compiler should be able to constant-fold the comparison
5756 benchmark::DoNotOptimize (new_excptr == nullptr );
57+ benchmark::DoNotOptimize (new_excptr);
5858 }
5959}
6060BENCHMARK (bm_exception_ptr_move_ctor_null);
@@ -74,9 +74,9 @@ void bm_exception_ptr_copy_assign_null(benchmark::State& state) {
7474 for (auto _ : state) {
7575 std::exception_ptr new_excptr;
7676 new_excptr = excptr;
77- benchmark::DoNotOptimize (new_excptr);
7877 // The compiler should be able to constant-fold the comparison
7978 benchmark::DoNotOptimize (new_excptr == nullptr );
79+ benchmark::DoNotOptimize (new_excptr);
8080 }
8181}
8282BENCHMARK (bm_exception_ptr_copy_assign_null);
@@ -99,9 +99,9 @@ void bm_exception_ptr_move_assign_null(benchmark::State& state) {
9999 for (auto _ : state) {
100100 std::exception_ptr new_excptr;
101101 new_excptr = std::move (excptr);
102- benchmark::DoNotOptimize (new_excptr);
103102 // The compiler should be able to constant-fold the comparison
104103 benchmark::DoNotOptimize (new_excptr == nullptr );
104+ benchmark::DoNotOptimize (new_excptr);
105105 }
106106}
107107BENCHMARK (bm_exception_ptr_move_assign_null);
@@ -122,8 +122,6 @@ void bm_exception_ptr_swap_null(benchmark::State& state) {
122122 std::exception_ptr excptr2 = nullptr ;
123123 for (auto _ : state) {
124124 swap (excptr1, excptr2);
125- benchmark::DoNotOptimize (excptr1);
126- benchmark::DoNotOptimize (excptr2);
127125 // The compiler should be able to constant-fold those comparisons
128126 benchmark::DoNotOptimize (excptr1 == nullptr );
129127 benchmark::DoNotOptimize (excptr2 == nullptr );
0 commit comments