<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 - Wrong LDRD's stack offset is generated in prologue/epilogue emission"
   href="https://bugs.llvm.org/show_bug.cgi?id=46034">46034</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong LDRD's stack offset is generated in prologue/epilogue emission
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>victor.campos@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23519" name="attach_23519" title="Input file">attachment 23519</a> <a href="attachment.cgi?id=23519&action=edit" title="Input file">[details]</a></span>
Input file

Commit 8a12553223180246eeafaa0fa7bfa11e834d34b6 introduced an optimization
where volatile i64 loads and stores are translated into LDRDs and STRDs instead
of pairs of LDRs and STRs.

However, it has been reported that, in some specific cases, LLVM generates
erroneous offsets for loads that access stack objects.

>From what I could find out by investigating, the patch did not introduce this
bug. It only made it emerge elsewhere.

Comparing CodeGen's debug outputs with and without the optimization, apart from
a minor difference in instruction scheduling, the real difference takes place
in Prologue/Epilogue emission, where the stack offset generated in the two
versions differ wildly.

This observation points out to Prologue/Epilogue Emission as the likely
culprit.

The mentioned patch has since been reverted while this bug remains outstanding.

To reproduce:
clang -O0 -target armv7a-cros-linux-gnueabihf -mthumb nacl_test.i -S</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>