<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 - LR not correctly saved for inline assembly clobbering LR"
   href="https://bugs.llvm.org/show_bug.cgi?id=47811">47811</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LR not correctly saved for inline assembly clobbering LR
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </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: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>programmerjake@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following IR is miscompiled:
<a href="https://gcc.godbolt.org/z/s6c6vT">https://gcc.godbolt.org/z/s6c6vT</a>

target triple = "powerpc64le-unknown-linux-gnu"

define void @f() {
  call void asm sideeffect "mtlr 31", "~{lr}"()
  ret void
}

Generated Assembly (trimmed to just f()):
f:                                      # @f
.Lfunc_begin0:
        .cfi_startproc
# %bb.0:
        #APP
        mtlr    31
        #NO_APP
        blr

This causes f to return to whatever address was in r31 instead of to the
caller. I expect LLVM to instead store the return address that was in LR to
another register or to the stack and restore it before returning.</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>