<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - MergeConsecutiveStores fails in presence of preceding load"
   href="https://llvm.org/bugs/show_bug.cgi?id=31063">31063</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MergeConsecutiveStores fails in presence of preceding load
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>djones@xtreme-eda.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17613" name="attach_17613" title="IR illustrating bug">attachment 17613</a> <a href="attachment.cgi?id=17613&action=edit" title="IR illustrating bug">[details]</a></span>
IR illustrating bug

The attached IR file defines two functions test_func, and test_func3.  These
functions perform consecutive stores of constants, and expect the backend to
combine the byte stores into a larger store.

Using LLVM 3.9.0 release on x86-64 Debian Linux, I get:

        .text
        .file   "test.ll"
        .globl  test_func
        .p2align        4, 0x90
        .type   test_func,@function
test_func:                              # @test_func
        .cfi_startproc
# BB#0:                                 # %bb_1
        movw    $770, 80(%rdi)          # imm = 0x302
        xorl    %eax, %eax
        retq
.Lfunc_end0:
        .size   test_func, .Lfunc_end0-test_func
        .cfi_endproc

        .globl  test_func3
        .p2align        4, 0x90
        .type   test_func3,@function
test_func3:                             # @test_func3
        .cfi_startproc
# BB#0:                                 # %bb_1
        movq    (%rdi), %rax
        movb    $4, 80(%rax)
        movb    $5, 81(%rax)
        xorl    %eax, %eax
        retq
.Lfunc_end1:
        .size   test_func3, .Lfunc_end1-test_func3
        .cfi_endproc

The stores were merged for the first case, but not the second.  The only
difference between the two is that in the second case, there is a preceding
load, which may alias the stores.  If this load occurred in between the stores,
then it is clear that combining the stores is wrong, as you ought not to move
stores around a possibly aliasing load. However, this is not the case here: the
stores follow the load, and combining them will not affect the load.</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>