<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74565>74565</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Possible missed import of functions for indirect-call-promotion when linkage-name differs from mangled-name for local-linkage functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
minglotus-6
</td>
</tr>
</table>
<pre>
[Global identifiers](https://github.com/llvm/llvm-project/blob/41507fe595d0fa3d81e151d70431d51897f8d14d/llvm/lib/IR/Globals.cpp#L144-L166) has the format `[filename:]<mangled-name>`, and its MD5 hash are known as GUIDs to compute the import of referenced symbols in ThinLTO.
When the referenced symbols is a callee of indirect call, the reference edge comes from PGO profiles as the MD5 hash of IRPGO function names, which has the format `[filename;]<linkage-name>` ([more details](https://github.com/llvm/llvm-project/blame/fe051934cbb0aaf25d960d7d45305135635d650b/llvm/lib/ProfileData/InstrProf.cpp#L278-L302))
Looking at the code ([Mangler](https://github.com/llvm/llvm-project/blob/06c5c27e44757e4917f7d7c995720ae8a2d3b1f9/llvm/lib/ProfileData/InstrProf.cpp#L307) used to compute IRPGO names), <linkage-name> (e.g., considering [linkage](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L123-L127) and [calling-convention](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L148-L166)) and <mangled-name> (e.g., emitted by Clang for C++) _could_ be different. This difference means possible missed import of functions as indirect-call-promotion callees (or when reference edge needs to be deduced from raw profiles using a similar approach to ICP).
Create this issue so the missed import issue (and thereby missed opt) is tracked.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVVGP2ygQ_jXkBSUy2BjzkIdmc6lWStVV1dM9VhgGm1sMEeCu9t-fcJLdbNvT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