-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
The C++ code:
bool foo (unsigned a)
{
return a != -a;
}on AArch64 LLVM -O2 generates:
foo(unsigned int): // @foo(unsigned int)
lsl w8, w0, #1
cmp w8, #0
cset w0, ne
retGCC does the more compact:
foo(unsigned int):
cmn w0, w0
cset w0, ne
retGodbolt link: https://godbolt.org/z/z8Mnhh6q4
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization