[PATCH] D53030: [MicroBenchmark] Add initial LoopInterchange test/benchmark.

Brian Homerding via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 07:16:32 PDT 2018


homerdin added inline comments.


================
Comment at: MicroBenchmarks/LoopInterchange/main.cpp:58-59
+    int y = test1(M, N);
+    if (state.range(0) == 20)
+      printf("%d\n", y);
+  }
----------------
fhahn wrote:
> MatzeB wrote:
> > Is the `printf` here a good idea? You'll artificially make one iteration slower which could possibly make the benchmark library take longer to stabilize until the result is statistically significant.
> I've added a comment to the code. It's never called with state.range(0), so the printf should be never executed, but ensure the test1 calls cannot be optimized away.
Can preventing the call being optimized away be accomplished using `benchmark::DoNotOptimize()` or `benchmark::ClobberMemory()`?


https://reviews.llvm.org/D53030





More information about the llvm-commits mailing list