-
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
GCC outputs the same sequence of instructions for the following two functions. Clang doesn't simplify the function foo
. The transformation from foo
to bar
can be proved.
int foo(int a, int b)
{
return (~a & b) && ~a;
}
int bar(int a, int b)
{
return (~a & b) && b;
}
Godbolt: https://godbolt.org/z/1cfP7Y5x6
Alive2: https://alive2.llvm.org/ce/z/HDJVkD
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization