<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 - [ARM] Machine Outliner issue with LDRD/STRD in Thumb mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=50481">50481</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ARM] Machine Outliner issue with LDRD/STRD in Thumb mode
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </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>yvan.roux@linaro.org
          </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>This issue was reported and described by rust-lang community here:

<a href="https://github.com/rust-lang/rust/issues/85351">https://github.com/rust-lang/rust/issues/85351</a>

The problem occurs when the machine outliner extracts a chunck of code which
contains a call and loads or stores a pair of registers from or into the
stack, such as:

  bl foo
  strd r0, r1, [sp, #0]
  strd r2, r3, [sp, #8]

LR needs to be saved into the stack when jumping in such an outlined
function and stack's offsets should be changed accordingly, thus the
function should look like:

<OUTLINED_FUNCTION_0>:
  str.w lr, [sp, #-8]!
  bl foo
  strd r0, r1, [sp, #8]
  strd r2, r3, [sp, #16]
  ldr.w lr, [sp], #8
  bx lr

But in the code generated by llvm-12 for Thumb2 targets, the stack offsets
are not patched.  In fact, these offsets are patched in the MIR by the
Machine Outliner, but it assumes that immediates encoded in
AddrModeT2_i8s4 instructions are scaled like it is the case for the other
addressing modes.

I'll submit a small patch to fix the outliner which will change the scale
and bit number in that part, but maybe it'd be nice to do a bigger change
to make the encoding more consistent (there are already some fixme notes
about that in the code)</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>