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

    <tr>
        <th>Summary</th>
        <td>
            -deadargelim doesn't eliminate unused argument and parameter
        </td>
    </tr>

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

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

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

<pre>
    Recently, I compiled binutils-2.43.1 with llvm-18 in -O2 and -deadargelim, but i found that the unused parameter of function bfd_hash_entry and argument in  its callsite, both aren't eliminated. the source code of bfd_hash_entry in addr2line list below:

> struct bfd_hash_entry *
bfd_hash_newfunc (struct bfd_hash_entry *entry,
                  struct bfd_hash_table *table,
                  const char *string ATTRIBUTE_UNUSED)
{
  if (entry == NULL)
    entry = (struct bfd_hash_entry *) bfd_hash_allocate (table,
                                                         sizeof (* entry));
  return entry;
}




part of the bitcode with -O2 and -deadargelim  flag on lists below
> define dso_local ptr @bfd_hash_newfunc(ptr noundef readnone %0, ptr nocapture noundef readonly %1, ptr nocapture readnone %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %5, label %21



it's quite interesting, why in this situation the dead argument and parameter are not killed? Is this due to inadequate optimization implementations.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VMFu2zgQ_Rr6MoghkZJlHXRw6xgIUHSBbnI2KHFkcUuRCjmskX79grTTNE53AQK2OMM3j-8NR4agTxaxY_UnVu9XMtLkfDfJ4fskX3DVO_XSfcMBLZkXxj_DAwxuXrRBBb22kbQJd3xdiXUJZ00TGPNjviu3oC3c_cVBWgV3CqWS_oRGzwmijwQaRhetApokAU0I0caAChbp5YyEHtwIY7QDaWehH9VxkmE6oiX_kkGlP8UZLaVCoCnAII0JmjBXcDSB9GgZbwhSXW0loVrnUsFFPyAMTmGqcgOuLUilPDfaIhgdCHo07szEjhV5iXsI5ONAtycZT_FfmxbP6QLA-PY_8_Mfxj9n6JYVLXzAJtkbTLn5z_vcwdlAMEzSp4RAXtsT7B4fvz18enq8Pz59ffr7fs94m440n1ixA9BjInQlIPZM7OHr05cvlyQAgF-h_yXOePu2K41xg6TEcvuB5c2CoH-iyyQY38FVgDYtcWHokaK310jeY83-qv3rWqSn5F2ys9eUrczt96eeAxiNPIGz2c5w9fPipMIx-ayCO6Y7GFjIA6uKWxcZ36aITU2LI3iUyjqbblwXqeMuwUEuFD2-S3PWJMXq8mPa7yg8KZopHKO1ckZ1TG0IjIsCXs1jvK6yNXqYF8DnC9srBRuNyVm9B13m3LRtZI8mfdXvvnj5u56aGG8CPEdNCNoSegyk7SkdOU_5UdCkAwRNUeYnmZRPGr89xCT72_OVWQaC79oYVEwc4CFcMFREIAfaSoXPMbWNW0jP-ucFWM-LwQSYP8OaFbuV6oRqRStX2JWN4Jtm22z5auo2RdWMfCMk9uO4qcu-VbwZmk3Z11VdCLHSHS94VZa8KYRoK74uRN2KoRo3YzMoVQtWFThLbdZpbq2dP610CBG7smy2YrvKcoU8HDm3eIYcZZynWem7POz6eAqsKnJvvcGQJoPduzZUDsPNRHode38WcRW96SaiJaTpww-MH06aptivBzczfkjFrj93i3f_4ECMHzLFwPjheocfHf83AAD__1aS6lc">