<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106209>106209</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[M68k] M68kExpandPseudo::ExpandMI and M68kInstrInfo::ExpandMOVEM incorrectly promote 8bit and 16bit registers to 32bit
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TechnoElf
</td>
</tr>
</table>
<pre>
The functions `M68kExpandPseudo::ExpandMI` and `M68kInstrInfo::ExpandMOVEM` unconditionally promote MOVEM instructions to their 32bit variant to allow collapsing multiple consecutive instructions. This optimisation, however, clashes with the representation of these values in memory. For instance, a 16bit value will still only be allocated 2 bytes on the stack, causing unrelated data to be overwritten when the 32bit MOVEM is executed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8kkFzmzAQhX-NuOyEAYENPnBIm3gmh0x7yPQupMWoERIjrSD-9x3J7rS55GIzy9u3u49PhKAvFnFgh2_s8FSISLPzwxvK2bpnMxWjU9fhbUaYopWknQ3AjtXrsX9__liFVT8DRuVY88iax1vl9YUdKxBW_RW-2ED-xU6fVT9-Pb8mYbTSWaWTtTDmCqt3iyOELACdeuN9MDmgGbWHho-aYBNeC0upLIxxO0hnjFiDthdYoiG9GgTpbEAZSW_4yayEt1kHcCvpRQeRaox_h9ntuKFPj9KIMGOAXdOc5oLH1WNAS1kNbkrVgLAJEzGAtrDg4vy1hLPzeZiwEpOVgPp429hEhF0bA4HSr7PmCiPm_aUgVMBhvBIGcDbPDCTke95GxHxYtB5NVipBIt0-IrgN_e41EVrYZ7y13kK6xxgAP1IMqMpCDY06NSdR4FB3vO0OfdvxYh6abuTtaVRVx0VT9X3TTpOalBwPcmpxmgo98Iq3Vc-7um7ahpcnjgfRN3WnsK3HRrG2wkVoUxqzLaXzl0KHEHGoqyOvToURI5qQUePc4g75LeM8keeH1PQwxktgbWV0oPDPhjSZzGjiiR2e4GsAM31fowfaSuc9SvqPuT4llnpvn8vjRQdCn8nLcRbRm2EmWkMy5GfGzxdNcxxL6RbGz2nh-9_D6t1vlMT4OZ8ZGD_fc9gG_icAAP__PPctkg">