https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91459
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-08-16
Component|middle-end |tree-optimization
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this has a duplicate somewhere. The reason is we end up with
foo1 (int a, int b)
{
<bb 2> [local count: 1073741824]:
function_returns_only_1_or_doesnt_return (a_2(D), b_3(D));
return 1;
and thus no obvious tail-call opportunity. Here it is EVRP replacing
result_5 with 1 in
<bb 2> :
result_5 = function_returns_only_1_or_doesnt_return (a_2(D), b_3(D));
if (result_5 == 1)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
// predicted unlikely by early return (on trees) predictor.
return result_5;
<bb 4> :
__builtin_unreachable ();
where it would be better to transform this idiom to unconditional
return result_5 early.