From 48a18de1e1e7dfeab6d034765caaf732b53cfcb7 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Fri, 17 May 2013 19:10:33 +0530 Subject: 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. --- scripts/bench.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/bench.pl') diff --git a/scripts/bench.pl b/scripts/bench.pl index dcc5ead..dcf1355 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; -- cgit v1.1