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