<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 - [GlobalISel][AArch64] Two load instructions generated for single volatile load"
   href="https://bugs.llvm.org/show_bug.cgi?id=36018">36018</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GlobalISel][AArch64] Two load instructions generated for single volatile load
          </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>GlobalISel
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>john.brawn.123@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For the following IR:

  @g = global i16 0, align 2
  declare void @bar(i32)

  define hidden void @foo() {
    %1 = load volatile i16, i16* @g, align 2
    %2 = sext i16 %1 to i32
    call void @bar(i32 %2)
    ret void
  }

llc -mtriple=aarch64 -global-isel generates for the load followed by sext:

  adrp  x8, g
  add   x8, x8, :lo12:g
  ldrh  wzr, [x8]
  ldrsh w0, [x8]

g is loaded twice, once with a zero-extending load which is discarded, and
second with a sign-extending load. For a volatile load we should be generating
only a single load instruction.</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>