<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120879>120879</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++23] I want `[[assume(p1 != p2)]]` can be optimized as __restrict
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
GoodenoughPhysicsLab
</td>
</tr>
</table>
<pre>
```cpp
int f(int *a, int *__restrict b) noexcept {
*a = 1;
*b = 2;
return *a + *b;
}
int f2(int *a, int *b) noexcept {
[[assume(a != b)]];
*a = 1;
*b = 2;
return *a + *b;
}
```
```asm
f(int*, int*):
mov dword ptr [rdi], 1
mov dword ptr [rsi], 2
mov eax, 3
ret
f2(int*, int*):
mov dword ptr [rdi], 1
mov dword ptr [rsi], 2
mov eax, dword ptr [rdi]
add eax, 2
ret
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysU92K4zwMfRrlxkyxZefvIhfJlH58sBf7BoMTu42XJA62Mz_79IvTZFuWLsPAFoNc6Vg6R5Gk9-YyaV1B2kB6TOQSeuuq_6xVerLLpf_ef3jT-W-yTVqrPirI6PV08wy0BlqbKZAzYBEtYC0Bn8l2f3lx2gdnukBawJJMVr93eg4E8gZoTQhZXxDgR8KA3_na1Yc3n9NhcdMGx2bFXKOQH--I4GMmfy0fZTfS-2XUgEXMzWLliIf0GA__EtVPee79u3L-_Vf6EWi99RGw3rivtxJ4vdWLv9G-rla9WafIHFxU4ZSJZPGZsE-hfofiA6iW7zHENzFXmntb_ymxr5N6lPgGlkrtwPscm4i90YmquCp5KRNdsZyLIs25yJK-4qxM5ZkVTPDy3Kks423eKU1FiUKlTCSmQoqCISItREmzQ9HmLO9yofGspMgpCKpHaYbDMLyOB-suifF-0RVDWuRlMshWD37dNMRJv5E1Cohx8VwVHz21y8WDoIPxwd_SBBOGdUWfARvABjmkR_I_eZNxujP6xxTPbB_jGW9znFHSyYm0mtg5mNH81IpIT247mixuqPoQZh8_K54ATxcT-qU9dHYEPEU6m3manf2huwB4WkV4wNOm8rXCXwEAAP__IwErfA">