diff options
| author | Jakub Jelinek <[email protected]> | 2020-12-15 20:43:37 -0800 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2020-12-15 22:46:16 -0800 |
| commit | 2f78788b55baa3410b1ec91a576286abe1ad4d6a (patch) | |
| tree | b3040cbef4a4ceb60035560e901f76ebe45a813f /tools/perf/scripts/python/stackcollapse.py | |
| parent | 7546861a8c55f1d704a6cfd699b33a9e2dd8c021 (diff) | |
ilog2: improve ilog2 for constant arguments
As discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445 the
const_ilog2 macro generates a lot of code which interferes badly with GCC
inlining heuristics, until it can be proven that the ilog2 argument can or
can't be simplified into a constant.
It can be expressed using __builtin_clzll builtin which is supported by
GCC 3.4 and later and when used only in the __builtin_constant_p guarded
code it ought to always fold back to a constant. Other compilers support
the same builtin for many years too.
Other option would be to change the const_ilog2 macro, though as the
description says it is meant to be used also in C constant expressions,
and while GCC will fold it to constant with constant argument even in
those, perhaps it is better to avoid using extensions in that case.
[[email protected]: coding style fixes]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/20201021132718.GB2176@tucnak
Signed-off-by: Jakub Jelinek <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Randy Dunlap <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions