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

    <tr>
        <th>Summary</th>
        <td>
            Mistake eliminating function call
        </td>
    </tr>

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

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

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

<pre>
    ```
#include <malloc.h>
#include <stdint.h>
#include <string.h>

struct xx {
        int *base;
 int *r1;
        int *r2;
        int *r3;
};

void f(struct xx *s) {
 int    prealloc_idx = 0;
        int64_t prealloc_size = 0;
 uint8_t **preallocs[64];
        {
                s->r1 = (void*)(intptr_t)prealloc_size;
                preallocs[prealloc_idx++] = (uint8_t**)&(s->r1);
                prealloc_size += sizeof(int) * 128;
 }
        {
                s->r2 = (void*)(intptr_t)prealloc_size;
 preallocs[prealloc_idx++] = (uint8_t**)&(s->r3);
 prealloc_size += sizeof(int) * 128;
        }
        {
 s->r3 = (void*)(intptr_t)prealloc_size;
 preallocs[prealloc_idx++] = (uint8_t**)&(s->r3);
 prealloc_size += sizeof(int) * 128;
        }
        s->base = malloc(prealloc_size);
        while( prealloc_idx-- )
 *preallocs[prealloc_idx] = (uint8_t*)((intptr_t)(*preallocs[prealloc_idx]) + (intptr_t)s->base);

        memset(s->r1, -2, sizeof(int) * 128);
 memset(s->r2, -2, sizeof(int) * 128);
        memset(s->r3, -2, sizeof(int) * 128);
}
```

In this code, `memset` are eliminated.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcld1uozwQhq9mOLESmTEm5IAD0jTSd_BdQ2SwG7xrIItN_65-ZSA_btOqW-3RWigBe-ad9xkwCGv1oVUqB74Bvo3E4Oquz59erX35JaKyky85pHQ-aAHIdFuZQSoC7K4RxnTVsgZ2_27NOqlb99Far9vDeY0W1vVD5cjzM4HVBmhB5qFbRwCLUlgFbFyYZ_p4vg4De7w9zaZpWG3nE1o8dlqSB8DsqjYWFnB98uCTCSHHXo2Yey2fCbAtoe9qpMneXeKsflVB4KBbl-1HJ4DFKc4C36QJ8G0oFzbgNOwC2H0fj7KAmTc_qq0BM926o-v3DnAdeAh1T-O6_DUa4MYffHuqMbueTI-VUt-tyYi__lR-7gJuvJo_7x4mq2ODsSAxZrOCvytf48fv8P8VYHYB_gbhGe0G6Kz_L5GNwn7PjvWnlwRgFiK8fYCeam0UYBbst8WC-ED_kIQbJ8C9DeobGPZwnPhMZuLbkDDtjHP2fGW7UY1V7npj3JEF-t-PGncGf5OKf5B6uzj7usJ0w4I3Oy3-a4mrtSVVJ5UXgZTOFVJKRK-IMrrRrXBKLiOZM7lmaxGpPF4lGc9iTOOozpkqV6ms-CpJBROlTLJVqriIY5kwJjGOdI4UOeWMUk5jSpesSinnlUx4Uq0qmkJCVSO0WRrz2Cy7_hBpaweVxwnSLI2MKJWx4wcLsVVPZFwFRP_96nOftCiHg4WEGm2dvcg47YzK_9fWiZ8XGN0eyMPQVk53LamEMdHQm7x27miBFYA7wN1Bu3ool1XXAO683vy3OPbdD1U5wN3owgLuZpuPOf4OAAD__yJTDpM">