-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
Consider the following functions:
int foo(int a)
{
return !a == (a > 0);
}
int bar(int a)
{
return (a < 0);
}
int baz(int a)
{
return !a == (a < 0);
}
int qux(int a)
{
return (a > 0);
}
Both Clang and GCC can optimize foo
to bar
. GCC can also optimize baz
to qux
, but Clang cannot.
https://godbolt.org/z/exvTE8Gn7
https://alive2.llvm.org/ce/z/LGvASc
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization