[Bug tree-optimization/101240] [missed optimization] Transitivity of less-than and less-or-equal
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 29 07:01:34 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101240
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |85316
Last reconfirmed| |2021-06-29
CC| |amacleod at redhat dot com
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
EVRP sees
<bb 2> :
_1 = (*a_8(D))[0];
_2 = (*a_8(D))[1];
if (_1 < _2)
goto <bb 3>; [INV]
else
goto <bb 5>; [INV]
<bb 3> :
_4 = (*a_8(D))[2];
if (_2 < _4)
goto <bb 4>; [INV]
else
goto <bb 5>; [INV]
<bb 4> :
__builtin_unreachable ();
<bb 5> :
_6 = (*a_8(D))[2];
_9 = _1 < _6;
so predicate analysis should handle this (but it does not). Btw, I fixed
the testcase for you:
#define ALWAYS_TRUE(x) do { if (x) __builtin_unreachable(); } while (false)
bool test_array(unsigned (&a)[3]) {
ALWAYS_TRUE(a[0] < a[1] && a[1] < a[2]);
return a[0] < a[2];
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases
More information about the Gcc-bugs
mailing list