-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
Code:
int popcnt(int x) {
int cnt = 0;
while (x) {
cnt++;
x &= x - 1;
}
return cnt;
}
On x86-64 clang 16.0.0 as well as trunk (17.0.0 d7fa921) with -O -march=haswell
compiles to:
popcnt: # @popcnt
popcnt eax, edi
cmove eax, edi
ret
(Note the unnecessary cmove)
On clang 15.0.0 with the same options:
popcnt: # @popcnt
popcnt eax, edi
ret
Aster89
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization