<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62297>62297</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Does the LLVM C-API LLVMIntrinsicCopyOverloadedName2 return correct name for overloaded intrinsic?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SixWeining
</td>
</tr>
</table>
<pre>
# Description
I suppose `LLVMIntrinsicCopyOverloadedName2` should return as short name as it can to uniquely identify the intrinsic. But seems that it return a full name which including all param types. Am I wrong?
# Test case
```
// test.c
#include <llvm-c/Core.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
LLVMPassRegistryRef pr = LLVMGetGlobalPassRegistry();
LLVMInitializeCore(pr);
size_t len;
int ret = 1;
const char *name_base = "llvm.minnum";
//const char *name_overload_expected = "llvm.minnum.f32";
//const char *name_overload_returned = "llvm.minnum.f32.f32";
LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
LLVMTypeRef f32 = LLVMFloatType();
LLVMTypeRef types[] = {f32, f32};
LLVMValueRef function = LLVMAddFunction(
m, name_base,
LLVMFunctionType(f32, types, sizeof(types) / sizeof(LLVMTypeRef), 0));
printf("name: %s\n", LLVMGetValueName2(function, &len));
// I suppose this API returns "llvm.minnum.f32" (which is expected by verifier)
// but in fact it returns "llvm.minnum.f32.f32".
char *name_new = LLVMIntrinsicCopyOverloadedName2(
m, LLVMGetIntrinsicID(function), types,
sizeof(types) / sizeof(LLVMTypeRef), &len);
printf("name_new: %s\n", name_new);
free(name_new);
LLVMDeleteFunction(function);
LLVMDisposeModule(m);
return 0;
}
```
# Build and run the test
```
$ clang test.c -o test `llvm-config --cflags --ldflags --libs all --system-libs`
$ ./test
name: llvm.minnum
name_new: llvm.minnum.f32.f32
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVl2TmzYU_TXyy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