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

    <tr>
        <th>Summary</th>
        <td>
            AttributeList::removeAttributesAtIndex should really remove the attribute instead of let the attribute be empty
        </td>
    </tr>

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

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

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

<pre>
    Currently AttributeList::removeAttributesAtIndex set attribute in specified Index empty https://github.com/llvm/llvm-project/blob/main/llvm/lib/IR/Attributes.cpp#L1422 instead of remove it really, so after AttributeList::removeAttributesAtIndex call, AttributeList::getNumAttrSet() still keeps unchanged which have potential issues for the API users. SPIRV-LLVM-Translator uses the call https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/lib/SPIRV/SPIRVBuiltinHelper.cpp#L187,L189 when remove function args and it causes wrong function attribute sets.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk0Fv2zgQhX8NdRnEkEayZB10cLLQrrHeRZAUuVPUWGJLkwI5jOt_X0iunaANCuREgPM4GH7zngxBD5aoEet7sf4rkZFH55tROivtWSad68_NQ_SeLJszbJm97iLTXgcW-VbkW09H90q3Qtjyzvb0HQIxyOstaAthIqUPmnq4COg48RlG5inMnbAV2A6ax9itlDsKbI15vR53k3dfSbHAtjOuE9gepbbvNHq-2z0JbN8mWalpEpjvswIRtA1Msgd3gMvEoBk8SWPOAh8gOJAHJv-ZHyppzPz2gycD8f_xOBeeiQVuBNYQWBsD34imANGqUdqBejiNWo0wyleCyTFZ1tKADiFSgIPzwCPB9nEHMZAPK3h-3D293O33L__dffHSBiPZ-bkYFuU80p-Q_jt6Z13427s4CWw_7PY74wXuor2e91Eb1vYfMhP5G-dNJfBhn21qOI1kr5wP0SrWzoL0QwBp-5m8ksvMJ-_s8E5x80sgDqukb_K-zmuZUJOVFeabtCyrZGyULFRZKVqvsy5V_bqnssOKaoVFmVUbmegGU8QM8zQtsyytVlXWY1cWUla16gpViSKlo9RmNRto5fyQLMybdV0VZWJkRyYsmUC0dLosRCDOEfHN4sguDkEUqdGBw1sX1myo-UxMRhdN_9OJV2TzKt9n52ZdQ_xLsaNLkJLoTfPpMF2MJrBd_v0jAAD__4MdY4E">