[PATCH] D40162: [XRay][test-suite] Update XRay microbenchmarks to use ranged for loops

Eizan Miyamoto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 17:55:06 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL318499: [XRay][test-suite] Update XRay microbenchmarks to use ranged for loops (authored by eizan).

Repository:
  rL LLVM

https://reviews.llvm.org/D40162

Files:
  test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
  test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc


Index: test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
===================================================================
--- test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
+++ test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
@@ -71,7 +71,7 @@
   if (state.thread_index == 0) {
     SetUpXRayFDRMultiThreaded(state);
   }
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     val = EmptyFunction();
     benchmark::DoNotOptimize(val);
   }
Index: test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
===================================================================
--- test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
+++ test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
@@ -25,7 +25,7 @@
 
 [[clang::xray_never_instrument]] static void BM_ReturnNeverInstrumented(
     benchmark::State& state) {
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     benchmark::DoNotOptimize(neverInstrumented());
   }
 }
@@ -41,7 +41,7 @@
 [[clang::xray_never_instrument]] static void BM_ReturnInstrumentedUnPatched(
     benchmark::State& state) {
   __xray_unpatch();
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     int x;
     benchmark::DoNotOptimize(x = alwaysInstrumented());
     benchmark::ClobberMemory();
@@ -55,7 +55,7 @@
     benchmark::State& state) {
   __xray_patch();
   __xray_unpatch();
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     int x;
     benchmark::DoNotOptimize(x = alwaysInstrumented());
     benchmark::ClobberMemory();
@@ -68,7 +68,7 @@
 [[clang::xray_never_instrument]] static void BM_ReturnInstrumentedPatched(
     benchmark::State& state) {
   __xray_patch();
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     int x;
     benchmark::DoNotOptimize(alwaysInstrumented());
     benchmark::ClobberMemory();
@@ -79,7 +79,7 @@
 
 [[clang::xray_never_instrument]] static void BM_RDTSCP_Cost(
     benchmark::State& state) {
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     unsigned cpu;
     unsigned tsc;
     benchmark::DoNotOptimize(tsc = __rdtscp(&cpu));
@@ -104,7 +104,7 @@
   __xray_set_handler(benchmark_handler);
   __xray_patch();
   benchmark::ClobberMemory();
-  while (state.KeepRunning()) {
+  for (auto _ : state) {
     int x;
     benchmark::DoNotOptimize(x = alwaysInstrumented());
     benchmark::ClobberMemory();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40162.123280.patch
Type: text/x-patch
Size: 2434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/2121affd/attachment.bin>


More information about the llvm-commits mailing list