https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Priority|P3 |P2
Known to work| |4.3.6
Target Milestone|--- |4.9.4
Summary|Missed opportunities for |[4.9/5/6 Regression] Missed
|smin/smax standard name |opportunities for smin/smax
|patterns when compiling as |standard name patterns when
|C++ |compiling as C++
Known to fail| |4.7.3, 5.3.0, 6.0
Severity|enhancement |normal
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
In the following testcase we used to do better with GCC 4.3 at least, handling
test_02 and test_04 completely and test_01 and test_03 half-way. Compared
to GCC 5 which only handles test_04 completely and test_03 half-way and
test_01 and test_02 not at all.
So this is a regression probably caused by adding maybe_canonicalize_comparison
to comparison folding, PR26899.
int test_01 (int a)
{
if (127 <= a)
a = 127;
else if (a <= -128)
a = -128;
return a;
}
int test_02 (int a)
{
if (127 < a)
a = 127;
else if (a <= -128)
a = -128;
return a;
}
int test_03 (int a)
{
if (127 <= a)
a = 127;
else if (a < -128)
a = -128;
return a;
}
int test_04 (int a)
{
if (127 < a)
a = 127;
else if (a < -128)
a = -128;
return a;
}