Assert while compiling CheckFunctionExists.cpp with llvm clang when -fveclib=SVML flag is enabled

CheckFunctionExists.c is a part of CMake and it is used by cmake to find whether the libarary function is supported or not. When CheckFunctionExists.c is compiled with llvm clang and with -fveclib=SVML flag. Assertion is occurring in InjectTLIMappings pass.

Preprocessed output of CheckFunctionExists.c:
// code start
char log2(void);
int main(int ac, char* av)
{
log2();
if (ac > 1000) {
return *av[0];
}
return 0;
}
// code end

The issue here is that InjectTLIMappings.cpp is trying to insert vectorized versions of the library function log2 into LLVM IR but vector version of char log2(void) is not present. Is it valid to redeclare a library function like this?

Clang command to reproduce the issue:-
clang -fveclib=SVML -DCHECK_FUNCTION_EXISTS=log2 -c CheckFunctionExists.c

I don’t think you can detect IFUNC or other detect-support-at-runtime symbol shenanigans with Check*Exists as they work at the language level and linker features like this live very far outside of any language. I feel like your LLVM/Clang is miscompiled if it is inserting code that isn’t available in the associated runtime library.

This might be more of an LLVM/Clang question.