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

    <tr>
        <th>Summary</th>
        <td>
            Clang unable to exploit pure function and unsequenced argument evaluation
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/dz595W6qe

Code:

```cpp
int y;

__attribute__((pure))
int g(int, int);

int f() {
        return g(y, g(0, 0));
}
```

clang backups `y` to a caller-saved register then restore it later, even though that shouldn't be necessary.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUstu6zgM_Rp6IzSQqcSOFl70Af_CLAPZYm3NKJIrUcGkX38hp-gtChAmQZ9zKD5Mzm4JRAOcXuD01pjCa0xDyZRQYo-6maK9DyvzlkE9A46A4xLtFD0fYloAx0_A0X6e9Omf7oNAvoF8fnxfo6XK-ZGCTj5s3rZHxgUWd1AvP1GXi2FObipMlwvgGfC8lUSAuto3bQE8u8CAr2J3-pdMxbzvdC2g__6lE3FJYaffK7kGsgbyq8K3TP_269k_5WdvwiImM_9Xtiygk3fopOAojJiN95SesrmRFYkWl5mS4JWCSJQ5JhKOhTdMqdalGwXBayzLKng1LPIai7cBsGcxkQg0U84m3Q-NHZTVSpuGhrbHVvWtOutmHVR7NAatOipslT23ncQjdWZStpcz9di4ASUeZd9q2R2V1AfVdr2lUze9o7InPcNR0tU4f_D-dq2rbVzOhQatO6kbbybyeb8SxL1zQKwHk4aKf5rKkuEovcuc_yqwY0_D6z6oEszkqc6H_t98dCzqTsV7CTO7GIQJVpSQ6aNQmMkKk5ZypcCCbsYXUzFNSf73KTpey3SY4xVwrHW_3NOW4r80M-C4t5EBx0cntwH_BAAA___ZDeQe">