<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58113>58113</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang fails to inline recursive function while gcc succeeds
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jrmuizel
      </td>
    </tr>
</table>

<pre>
    ```c++

#include <stdlib.h>

struct Foo {
    Foo * next;
};

static void drop_in_place(Foo* f) {
    if (f->next) { drop_in_place(f->next); }
    free(f);
}

void free_foo(Foo *f) {
    while (f) {
        Foo * next = f->next;
        f->next = 0;
        drop_in_place(f);
        f = next;
    }
}
```

See https://godbolt.org/z/YT4soroz9

GCC is able to inline `drop_in_place` and avoiding calling it recursively.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxlU8GSoyAQ_Rq8UGMhGKMHDrPJZj5g97KnFEKrTBFJAWZm8vWLxiQmsVAaut_r1w3WVv1wVJDLkIj-GgfZIvI-fynTvTSDAozYxgdldJ12iP1eBvngBhnwzlqM1jMcx2faoO-4h--A2JV3vb3bM1wELfHJaoWVs8e97vdHIyQgWkaKkaFBtHrk1k2kLpu3KGWiv_hf8MuAmBaP2W8cjYMp5uK7y1tom0SNcftmVFLOJb3q-eq0ATyzPbqeWxE7ucV3Yewp9OaZ4siL_6XEpfwbyQR-4b9XdzOuh7-s-g8A7kI4esTiDdjF0VpVWxNS69q4Osf339_cW2fP1RL4sdlg7bGoYy-Cxbo3uo9dKcij6IJg0Sssxu7qvsVSGDPOOmAHcnBen8D8pAnwrCjyNSuLrEoUZ6pilUiCDga4NCIiGqGNX6S6wXEz9DJo288n00qJ_SAlgPLJ4Ax_qk-HbqhTaQ9xYczpOr0dnf0EGa_PTns_gI_GqswylnRcwKrOV6SKpFlOVZXJYq2yoqQlg4JkTWJEDcZztIp_Fe3hC08U0UarbaI5JZRmhNCsooxVaUVB0EY2xTqXBKoS5QQOsbx01DE2PnF8klQPrY9Oo33wd6fwXrc9wJQu8oshdNbxT3cY9BlMMuXmk_b_IE0i_g">