[Bug ipa/115201] Recursive binary search is incorrectly inlined

2024-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115201

--- Comment #4 from Andrew Pinski  ---
Created attachment 58273
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58273=edit
Better (reduced testcase)

The tail call happens in the foo2 case while not in foo1. This is due to struct
returns are not always handled for tail call ..

[Bug ipa/115201] Recursive binary search is incorrectly inlined

2024-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115201

--- Comment #3 from Andrew Pinski  ---
Oh the issue is the iterator is a struct which confuses things ...

[Bug ipa/115201] Recursive binary search is incorrectly inlined

2024-05-22 Thread llvm at rifkin dot dev via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115201

--- Comment #2 from Jeremy R.  ---
Does recursive inlining here interfere with TCO, or is GCC just not able to TCO
in this case?

I can understand why some bounded recursive inlining may be desirable, however
in this case it seems very not ideal.

[Bug ipa/115201] Recursive binary search is incorrectly inlined

2024-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115201

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |ipa

--- Comment #1 from Andrew Pinski  ---
I suspect this is way GCC recursive inlining works and it is working correctly.
While LLVM does not do any recursive inlining (anywhere).