https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78200
--- Comment #16 from Venkataramanan <venkataramanan.kumar at amd dot com> ---
GCC7 added early treading pass and gimple thread pass before VRP. When I
disable these passes, tree-vrp is able to move the true block same as that of
GCC6.
It again the tree-if-convert causing the moved block to come back to its
original position. Also non canonical gimple gets formed.
<bb 27>:
_496 = _512 == 2;
_495 = red_cost_503 > 0;
_494 = _496 & _495;
if (_494 != 0)
goto <bb 28>;
else
goto <bb 29>;
<bb 28>: <== True block.
_502 = basket_size_lsm.75_514 + 1;
_501 = perm[_502];
_501->a = arc_516;
_501->cost = red_cost_503;
_498 = ABS_EXPR <red_cost_503>;
_501->abs_cost = _498;
If we turn off tree-if-conversion, the basic block reordering at RTL brings
back the block to its position. But we dont see regression since the check is
in order.
<bb 20>:
_344 = _23 == 2;
_345 = red_cost_86 > 0;
_342 = _344 & _345;
if (_342 != 0)
goto <bb 86>;
else
goto <bb 21>;
This makes me believe that swapping the operands causes the regression.