<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 - [PostRA Machine Sink] Sunk instruction corrupts liveness tracking"
   href="https://bugs.llvm.org/show_bug.cgi?id=36902">36902</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PostRA Machine Sink]  Sunk instruction corrupts liveness tracking
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20123" name="attach_20123" title="reduced testcase (for clang)">attachment 20123</a> <a href="attachment.cgi?id=20123&action=edit" title="reduced testcase (for clang)">[details]</a></span>
reduced testcase (for clang)

This instruction:

renamable $r0l = COPY renamable $r12l, implicit killed $r12q

copies a subreg ($r12l) of $r12q which is killed. It is sunk into this block:

bb.8..preheader26:
; predecessors: %bb.6
successors: %bb.10(0x50000000), %bb.9(0x30000000)
liveins: $r4d, $r0l, $r13l
renamable $r0d = LGFR killed renamable $r0l
renamable $r11d = LGFR killed renamable $r13l
CHIMux renamable $r4l, 0, implicit-def $cc, implicit killed $r4d
BRC 14, 10, %bb.10, implicit killed $cc

like

bb.8..preheader26:
; predecessors: %bb.6
successors: %bb.10(0x50000000), %bb.9(0x30000000)
liveins: $r4d, $r13l, $r12l
renamable $r0l = COPY renamable $r12l, implicit killed $r12q
renamable $r0d = LGFR killed renamable $r0l
renamable $r11d = LGFR killed renamable $r13l
CHIMux renamable $r4l, 0, implicit-def $cc, implicit killed $r4d
BRC 14, 10, %bb.10, implicit killed $cc

Note that another subreg of $r12q was already live into this MBB
($r13l). Since the sunk instruction now kills $r13l before its use,
machine veririer says:

*** Bad machine code: Using an undefined physical register ***
- function:    decode_one_b8block
- basic block: %bb.8 .preheader26 (0x2aa41875a08)
- instruction: renamable $r11d = LGFR killed renamable $r13l

- operand 1:   killed renamable $r13l


clang line:

bin/clang -march=z13  -mllvm -disable-machine-dce -mllvm -disable-machine-sink
-mllvm -extra-vectorizer-passes  -mllvm -enable-tbaa=false -mllvm
-verify-machineinstrs   -O3  -w  -o ./out.ll  ./tc_machinesink.ll

llc line:

bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=postra-machine-sink
./tc_machinesink.mir -O3 -verify-machineinstrs</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>