[PATCH] D64082: [MemFunctions] Add microbenchmarks for memory functions.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 03:50:27 PDT 2019


courbet marked an inline comment as done.
courbet added inline comments.


================
Comment at: MicroBenchmarks/MemFunctions/main.cpp:43
+  benchmark::DoNotOptimize(q_storage);
+
+  for (auto _ : state) {
----------------
lebedev.ri wrote:
> This may be paranoia, but i'm not sure this is sufficient to guarantee that compiler *can't* just look into `p`/`q`.
> I'd suggest adding this here:
> ```
>   benchmark::DoNotOptimize(p);
>   benchmark::DoNotOptimize(q);
> 
>   benchmark::ClobberMemory(p);
>   benchmark::ClobberMemory(q);
> ```
> (i see that you do that for `std::vector<char>`'s already, but you have already acquired `_storage.data()`..)
Sounds reasonable. I've even moved the ClobberMemory inside the call (and verified that benchmark numbers do not change).


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64082/new/

https://reviews.llvm.org/D64082





More information about the llvm-commits mailing list