<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58237>58237</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm][peephole] merge successive stack pointer modifications
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
for an i386 linux kernel build, I noticed in the prolog of core_sys_select() that we have:
```asm
380: 55 pushl %ebp
381: 89 e5 movl %esp, %ebp
383: 53 pushl %ebx
384: 57 pushl %edi
385: 56 pushl %esi
386: 83 e4 f8 andl $-8, %esp
389: 81 ec f0 03 00 00 subl $1008, %esp
```
Can't we merge the `and` of a negative value with the `sub` of a positive value into one instruction? I don't see control flow reliant on one of those vs both.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU8Fu3CAQ_Rr7MsoKw9prH3xIE0XqH_QWYRivaTBYBm-Sfn0HNptm1bQKQgbMvMebxzB4_dqPfgXpwIi2AWvc9gJPuDq0MGzG6oLfwXdwPhqFGoyDOCEsq7f-CH4E5Vd8DK_hMaBFFQveFryjGBnhGWGSJyzEbcHuC3b5NuzcZZjPfyA10TIKhLqG_7RlC5OlseA1DssVukrotgP8N8HsTwmc0WFJeX3CI7IK8WUVL1fofUYfvorW5gpdZ3TzVXS4RjfZAQG4h7H9HC2dfnNgf9NeDAjXBnSZpgJUMDJgAhhL_WML23ChqRj7i-j9hs_LO-kKfsjlMON6xFxA6f6dpm-qIQkOjzKaE8JJ2g3h2cTpEkaHvYctPpgPYcZFD96lSYjrpqLxrhAPVK7an88MiFShLlK5wmj9M6xojXSRUBlIrHHygQgDDD5OuxL7qmnqqmlFXZW6F7oTnSyjiRb7ov5m7Wku6nuaLYjL5C3S6i2vsCmFISR9IUr1RHJJIa5UeNqMRsmkL5TbavspxiWkh8EfqB8p3W3YKT_TIp9wHm7omf3Mj-rBhLBhoEndcnEop37UqjloLpqBa1SqYs0gmopJyTuuW6ZLKwe0IWkuOB9IDpLf4vYH1Qnn5yvjM9GivvFLNLP5lfWlzfq-ND1nnNPtHqp2X9fVrtu3XdeiwrFtKxxZsWc4S2N3SejOr8dy7bPmYTsG2rQmxPBnU5IvR4fZw8QvN_J97Z1RTxqD3KwzuIYyp9nnHH8DQnlJrQ">