Missed tail call optimization when local address could escape but not on the condition: void f(void); void f1(int *); void g(int i, int j) { if (j) return f(); return f1(&i); } This might be a reduced testcase from fold_binary to fold_build2 where we have this issue, but I have not looked through all of the conditionals to see if this is true.
Confirmed.
Very much related to PR 23384.
I see clang/LLVM can do this optimization.