Skip to content

Eliminate unused C DSP functions at compile time

Henrik Gramner requested to merge gramner/dav1d:trim_dsp into master

By inlining dav1d_get_cpu_flags() and the arch-specific DSP init functions in combination with assigning baseline CPU flags at compile time to match the compiler flags we can have the compiler perform dead code elimination of redundant C functions and function pointer assignments.

Requires use of __attribute__((always_inline)) to ensure that inlining decisions are performed prior to dead code elimination.

Enabled by default when compiling in release mode, but can be explicitly enabled or disabled.

One caveat is that this feature needs to be disabled for checkasm to function, as it requires having the C DSP functions available as references in order to verify the correctness of the assembly code.

Binary size comparison of the stripped shared library on x86-64:

          Clang      GCC
 old     1923584   2009088
 sse2    1883136   1967616
 ssse3   1698304   1717760
 avx2    1658368   1672704

 old      876856
 neon     700728

 old      664068
 neon     586212

Partially addresses #391.

Edited by Henrik Gramner

Merge request reports