<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 --- - Post-RA scheduler moves code across asm sideeffect"
   href="https://llvm.org/bugs/show_bug.cgi?id=28765">28765</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Post-RA scheduler moves code across asm sideeffect
          </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>All
          </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>Matthew.Arsenault@amd.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>define void @loop(i32 addrspace(1)* %arg) nounwind {
bb:
  br label %bb2

bb2:
  %loop.idx = phi i32 [ 0, %bb ], [ %inc, %bb2 ]
  call void asm sideeffect "
    v_nop_e64
    v_nop_e64", ""()
  %inc = add nsw i32 %loop.idx, 1
  %cmp = icmp slt i32 %inc, 10
  br i1 %cmp, label %bb2, label %bb3 ; -

bb3:
  ret void
}

llc -march=amdgcn on this testcase shows the add and compare are moved before
the inlineasm by the post-RA scheduler:


BB0_1:                                  ; %bb2
                                        ; =>This Inner Loop Header: Depth=1
    v_add_i32_e32 v0, vcc, 1, v0
    v_cmp_gt_i32_e32 vcc, 10, v0
    ;;#ASMSTART

    v_nop_e64
    v_nop_e64
    ;;#ASMEND
    s_and_b64 vcc, exec, vcc
    s_cbranch_vccnz BB0_1</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>