<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72094>72094</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MemProf] Assert failed in MemProfContextDisambiguation::applyImport
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lifengxiang1025
</td>
</tr>
</table>
<pre>
I met an error when try to use MemProf:
> bool llvm::MemProfContextDisambiguation::applyImport(llvm::Module&): Assertion `CB->getCalledFunction()' failed.
After debugging, I found `mayHaveMemprofSummary` returned true but `assert(CB->getCalledFunction())` failed.
The `CalledFunction` in `mayHaveMemprofSummary` is nullptr unitl:
```
if (auto *GA = dyn_cast<GlobalAlias>(CalledValue)) {
assert(!CalledFunction &&
"Expected null called function in callsite for alias");
CalledFunction = dyn_cast<Function>(GA->getAliaseeObject());
}
```
`CB->getCalledFunction()` is nullptr so it caused assert failed while CalledValue's aliasee is not nullptr so it pass `mayHaveMemprofSummary`.
So I think there may be a bug to be fixed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PpDYQ_TXmUpqWMQ0NBw5M9_RkDqtE2ijXyMYFODE28sfO9L-PcH9tr6IdLUIgcNXze_XKxb1Xo0FsSflMykPGY5isa7Ua0Iwfipsxp6zMhJWn9g1mDMANoHPWwfuEBoI7QbAQPcIXnP9wdiBFR-iB0OuzeAFhrQatv83rWtFdAvfWBPwIB-X5LNQYeVDWnCP4sujT27xYFwirv8u0MmokrCKsIUUHnffo1jQgFd0_P5HiZcSw51qjPEbTJ0RWr9FsBwNXGuXme3bdENCBRBHHUZmRsD28wWCjkSvizE-_8W_4BefF2eFrnGfuTqSi4DBEZ1BCcBFBxLBG80SGsPoTIs2K8MDlzwmTgMfwioIyP6WhPJio9RIcRKOCvpe-opc7fQKoAQireQwWCOteOyDFAeTJ_N1zH0ixf9VWcN1pxT0pXlYNictfXEc8kwaye76g3YQSlj9yhmRNdd31dhHGXj4W7APKxBj6lAbDNU-Z9MurgDBYBzwxYSz5_HzH-3G7RxW30iUJr93FhiQL8XfxD_bh7sINl-wO_1u2T3vq0QJvQQXoefQoLzW62Azvk9IIDzXd-bNIxIRhww84C_f-Z-ZfWuerhTcIkzL_QpjQIcz8BAKBg4jjejIFwqA-bq2WybaQTdHwDNu8apq6qhpaZlNbbGsp61I0zVDKYifKQshyO2wxlxJF02eqZZQVeZ4XtMlLWm4YzeuG4rbud7uKVxXZUpy50pv1vG6sGzPlfcR2x2izzTQXqH0aM4wZfIe0uFpcHjLXrjlPIo6ebKlWPvg7SlBBp_l0HTDl4XLwr-VVBn5ppmTR6XYKYfHrEjsSdhxVmKLY9HYm7JgGzvn1tDh7bptjIuwJOyZB_wUAAP__qIumBA">