<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121495>121495</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Remove external callers of combineMetadata and internalize
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
teresajohnson
</td>
</tr>
</table>
<pre>
The combineMetadata facility which was originally written for instruction CSE has been generalized and expanded in use, but this is causing issues with dropped metadata. See discussion in https://github.com/llvm/llvm-project/pull/121359.
The 2 external callers should be removed:
- MemCpyOpt should be migrated to its own custom handling that merges just AA metadata as intended, and leaves other metadata in place (https://github.com/llvm/llvm-project/blob/62d0aff3eb934439acac47348e2385f0751a1444/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp#L352)
- InstCombine should be calling combineMetadataForCSE (https://github.com/llvm/llvm-project/blob/62d0aff3eb934439acac47348e2385f0751a1444/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp#L791)
Once that is done, combineMetadata should be inlined into combineMetadataForCSE, or at least made internal and have the knownIds parameter removed (the switch statement already drops any metadata not explicitly handled there).
To avoid new metadata being inadvertently dropped in the future, it might be better to change this handling to require metadata to be explicitly listed in the switch statement, and assert otherwise.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzElMFu4zYQhp-GvgzWkCgpsg46uGmNBuhii2ZfYCSOrEkpUiVH9jpPX1Cu4zTby556MgxxOPP__P7BGPnoiFpV_aSqnze4yOhDKxQo4osfXfRu03lzab-OBL2fOnb0mQQNCsKAPVuWC5xH7kc4YwQf-MgOrb3AObAIORh8AHZRwtILewePz7_AiBE6IgdHchTQ8isZQGeAvs3oDBlgB0skpR-hWwRk5AgcocclsjsCx7hQhDPLCCb4eSYD0z9jbeGZCAzHfokxNWQHo8gcVbFX-qD04cgyLt2295PSB2tPt59Pc_Av1IvSh3mxVulDrvOiarYq26tsnyzQQN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