about summary refs log tree commit diff
path: root/scripts/bench.pl
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-17 19:10:33 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-17 19:10:33 +0530
commit48a18de1e1e7dfeab6d034765caaf732b53cfcb7 (patch)
tree1710f87c334a2d5cc79c30f9262212697eb814ef /scripts/bench.pl
parent13d3b41a36c4f28d171a144f8a9baad3a8835981 (diff)
downloadglibc-48a18de1e1e7dfeab6d034765caaf732b53cfcb7.tar.gz
glibc-48a18de1e1e7dfeab6d034765caaf732b53cfcb7.tar.xz
glibc-48a18de1e1e7dfeab6d034765caaf732b53cfcb7.zip
Prevent optimizing out of benchmark function call
Resolves: #15424

The compiler would optimize the benchmark function call out of the
loop and call it only once, resulting in blazingly fast times for some
benchmarks (notably atan, sin and cos).  Mark the inputs as volatile
so that the code is forced to read again from the input for each
iteration.
Diffstat (limited to 'scripts/bench.pl')
-rwxr-xr-xscripts/bench.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/bench.pl b/scripts/bench.pl
index dcc5ead727..dcf1355282 100755
--- a/scripts/bench.pl
+++ b/scripts/bench.pl
@@ -71,7 +71,7 @@ else {
       $decl = "$decl,";
     }
 
-    $arg_struct = "$arg_struct $arg arg$num;";
+    $arg_struct = "$arg_struct volatile $arg arg$num;";
     $bench_func = "$bench_func variants[v].in[i].arg$num";
     $decl = "$decl $arg";
     $num = $num + 1;