<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Missed opportunity for store elimination"
   href="https://bugs.llvm.org/show_bug.cgi?id=47887">47887</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed opportunity for store elimination
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>float r;

void t1( int& x)
{
    ++x;
    r = 0;
    --x;
}


void t2( int& x, float& rr )
{
    ++x;
    rr = 0;
    --x;
}

char c;

void t3( int& x, char& rr )
{
    ++x;
    c = 0;
    --x;
}

void t4( int& x, char& cc )
{
    ++x;
    cc = 0;
    --x;
}




Clang -O3:
t1(int&):                                # @t1(int&)
        mov     eax, dword ptr [rdi]
        mov     dword ptr [rip + r], 0
        mov     dword ptr [rdi], eax
        ret
t2(int&, float&):                              # @t2(int&, float&)
        mov     eax, dword ptr [rdi]
        mov     dword ptr [rsi], 0
        mov     dword ptr [rdi], eax
        ret
t3(int&, char&):                              # @t3(int&, char&)
        mov     eax, dword ptr [rdi]
        mov     byte ptr [rip + c], 0
        mov     dword ptr [rdi], eax
        ret
t4(int&, char&):                              # @t4(int&, char&)
        add     dword ptr [rdi], 1
        mov     byte ptr [rsi], 0
        add     dword ptr [rdi], -1
        ret
r:
        .long   0x00000000                      # float 0

c:
        .byte   0                               # 0x0


ICC -O3:
t1(int&):
        mov       DWORD PTR r[rip], 0                           #7.5
        ret                                                     #9.1
t2(int&, float&):
        mov       DWORD PTR [rsi], 0                            #15.5
        ret                                                     #17.1
t3(int&, char&):
        mov       BYTE PTR c[rip], 0                            #24.5
        ret                                                     #26.1
t4(int&, char&):
        inc       DWORD PTR [rdi]                               #30.7
        mov       BYTE PTR [rsi], 0                             #31.5
        dec       DWORD PTR [rdi]                               #32.7
        ret                                                     #33.1
r:
c:


Godbolt:

<a href="https://godbolt.org/z/zh35ch">https://godbolt.org/z/zh35ch</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>