[Bug tree-optimization/91384] [9/10/11/12 Regression] Compare with negation is not eliminated
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 22 16:05:29 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91384
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |tree-optimization
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So looking at what other compilers do here.
ICC and MSVC do what GCC did in GCC 4.1.2.
LLVM does similar to what GCC does now except they also push the -a to below
the if statement.
If we have:
void foo (int);
void bar (void);
int g(int, int);
int
test (int a)
{
int r;
if (r = -a)
foo (r);
else
bar ();
return r;
}
----- CUT ----
LLVM is able to produce the neg/branch combo now while GCC is not.
More information about the Gcc-bugs
mailing list