[Bug tree-optimization/91459] Tail-Call Optimization is not performed when return value is assumed.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91459 Andrew Pinski changed: What|Removed |Added Last reconfirmed|2019-08-16 00:00:00 |2021-12-26 --- Comment #4 from Andrew Pinski --- So when DOM3 changes: result_5 = function_returns_only_1_or_doesnt_return (a_2(D), b_3(D)); if (result_5 == 1) goto ; [100.00%] else goto ; [0.00%] [local count: 1073741824]: return 1; [count: 0]: __builtin_unreachable (); To result_5 = function_returns_only_1_or_doesnt_return (a_2(D), b_3(D)); return 1; I wonder if it could change 1 back into result_5 because it comes from a function call.
[Bug tree-optimization/91459] Tail-Call Optimization is not performed when return value is assumed.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91459 --- Comment #3 from Andrew Pinski --- Part of that might be because of: // predicted unlikely by early return (on trees) predictor. That seems not true, the other side is more unlikely ...
[Bug tree-optimization/91459] Tail-Call Optimization is not performed when return value is assumed.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91459 Richard Biener 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 --- I think this has a duplicate somewhere. The reason is we end up with foo1 (int a, int b) { [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 : result_5 = function_returns_only_1_or_doesnt_return (a_2(D), b_3(D)); if (result_5 == 1) goto ; [INV] else goto ; [INV] : // predicted unlikely by early return (on trees) predictor. return result_5; : __builtin_unreachable (); where it would be better to transform this idiom to unconditional return result_5 early.