Skip to content

Commit 74cfcd1

Browse files
committed
aarch64/vvc: Fix DCE undefined references with MSVC
This fixes compiling with MSVC for aarch64 after 510999f. While MSVC does do dead code elimintation for function references within e.g. "if (0)", it doesn't do that for functions referenced within a static function, even if that static function itself ends up not used. A reproduction example: void missing(void); void (*func_ptr)(void); static void wrapper(void) { missing(); } void init(int cpu_flags) { if (0) { func_ptr = wrapper; } } If "wrapper" is entirely unreferenced, then MSVC doesn't produce any reference to the symbol "missing". Also, if we do "func_ptr = missing;" then the reference to missing also is eliminated. But for the case of referencing the function in a static function, even if the reference to the static function can be eliminated, then MSVC does keep the reference to the symbol.
1 parent f10c0ae commit 74cfcd1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libavcodec/aarch64/vvc/alf_template.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,15 @@ static void FUNC2(alf_filter_luma, BIT_DEPTH, _sme2)(uint8_t *_dst,
259259
const int vb_pos)
260260
{
261261
if ((width >= 16) && (height >= 16)) {
262+
// If compiled without support for SME2 or SME-I16I64, we never assign
263+
// the function pointer anyway, but make sure we don't produce a
264+
// reference to the function which does not exist.
265+
#if HAVE_SME2 && HAVE_SME_I16I64
262266
int aligned_width = ALF_ALIGN_BY_4(width); // align width by 4
263267
uint64_t dims = ((uint64_t)height << 32u) | (uint64_t)aligned_width;
264268
uint64_t strides = ((uint64_t)src_stride << 32u) | (uint64_t)dst_stride;
265269
FUNC2(ff_vvc_alf_filter_luma, BIT_DEPTH, _sme2)(_dst, _src, strides, dims, filter, clip, vb_pos);
270+
#endif
266271
} else {
267272
FUNC2(alf_filter_luma, BIT_DEPTH, _neon)(_dst, dst_stride, _src, src_stride, width, height, filter, clip, vb_pos);
268273
}

0 commit comments

Comments
 (0)