benchtests: Mark output variables as used
authorSiddhesh Poyarekar <siddhesh.poyarekar@linaro.org>
Tue, 17 Nov 2015 10:31:15 +0000 (16:01 +0530)
committerSiddhesh Poyarekar <siddhesh.poyarekar@linaro.org>
Tue, 17 Nov 2015 10:31:15 +0000 (16:01 +0530)
Prevent function calls that don't return anything from being optimized
out by the compiler by marking its input variables as used.

This prevents the sincos function call from being optimized out in the
benchmark.

ChangeLog
benchtests/scripts/bench.py

index dd5a2b5b18a369a3cfe08dabcb0ebe8eed7c8627..2d53b2b4ae7f0bb77baaf1419d9f6fa62e315dd2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-17  Siddhesh Poyarekar  <siddhesh.poyarekar@linaro.org>
+
+       * benchtests/scripts/bench.py (_print_arg_data): Mark output variables
+       as used.
+
 2015-11-16  Florian Weimer  <fweimer@redhat.com>
 
        * math/test-signgam-finite-c99.c (_Mlong_double_): Undefine.
index ee856db8212100008dc2fb590d0d8d9d4453ada9..7752c8a7fb388538e9ded6e322fb2f91d40e9246 100755 (executable)
@@ -164,7 +164,7 @@ def _print_arg_data(func, directives, all_vals):
             if pos == -1:
                 die('Output argument must be a pointer type')
 
-            outargs.append('static %s out%d;' % (arg[1:pos], i))
+            outargs.append('static %s out%d __attribute__((used));' % (arg[1:pos], i))
             func_args.append(' &out%d' % i)
         else:
             arg_struct.append('  %s volatile arg%d;' % (arg, i))