<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98127>98127</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[PseudoProbe] llvm-profgen crashed due to .pseudo_probe_desc does not contain functions generated by optimization passes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
ipo,
PGO
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HaohaiWen
</td>
</tr>
</table>
<pre>
Issue description:
1. Some functions are generated by optimization passes. e.g. PartialInlinerPass.
2. PseudoProbeInserter inserts PSEUDO_PROBE MachineInstr when there're call instructions with pseudo probe discriminator in this function and uses GUID derived from this function's name. However, there's no corresponding info in .pseudo_probe_desc with this GUID since .pseudo_probe_desc only contain functions info generated by front end.
3. When llvm-profgen try to get PseudoProbeDesc using this GUID it would failed: `llvm/lib/MC/MCPseudoProbe.cpp:613: const MCPseudoProbeFuncDesc *llvm::MCPseudoProbeDecoder::getFuncDescForGUID(uint64_t) const: Assertion It != GUID2FuncDescMap.end()`.
Since this function is generated by LLVM optimization passes. The contents may vary based on profile file. That's means its CFGCheckSum may be different in SPGO step1 and step2. Any idea to fix that?
My idea is to update .pseudo_probe_desc in CodegenPrepare for new generated functions with `Function Hash` set to 0.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVNGO6jYQ_RrnZdQoOATIQx64cLOLdNGi0tv7uHLiSeI2sSOPA6VfX9mwuyAh9cWy5OMzM2fOjCBSrUYsWPaNZdtITK4ztngVphPqF-qoMvJS7IgmBIlUWzU6ZTRL1yzZsuR2zmI4mgGhmXTtnwmERWhRoxUOJVQXMKNTg_pX-GcYBRFSDBi3MRyEdUr0O90rjfYgiOIrK4_hQDhJc7Cmwp0mtA4tqHAhOBy__9y-vR9-f_v2Hfai7pT2IGfh3KEG16FFxpcWoRZ97785O93SOyvXwRjIYfTsIJUvblBaOONjgOsUfRYEQkuYCA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