https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108162
Bug ID: 108162 Summary: Missed optimization opportunity. Complex function that starts with if (param == 0) return 0; Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: levo.delellis at gmail dot com Target Milestone: --- I had a lot of fun writing https://bolinlang.com/does-it-inline I was intentionally trying to break the optimizer. I found a few cases in clang and two cases I don't think should apply but I think both can gain from the last one. Skipping a function call when the function starts with `if (param == 0) return 0;`. I tested with a recursive fibonacci. If you scroll to the very bottom you'll see it. Cases that clang optimizes but gcc did not A) Round 3 a and b. I don't think locale will affect it and clang optimizes it. All of round 4 clang optimizes. I suspect there's something getting in the way of peeking through push and size. I vaguely remember thinking std::forward may get in the way in the past but it was long enough ago that I don't remember what I was doing to think that