-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
llvm:optimizationsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
source code:
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;
}output:
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
retcompile with -std=c++23 -O3
Metadata
Metadata
Assignees
Labels
llvm:optimizationsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!