<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 --- - Machine operand's 'IsDead' flag set in the register coalescing pass becomes invalid after virtual register rewriter pass" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23741&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=x0t08j2GEsa6htS_1C6Yytni-ONJomRfQfDFd4t6cdI&s=4yLqZ4mqS89pdlmFyMEc__UvIgPV5lTchIA5E0lwqyQ&e=">23741</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Machine operand's 'IsDead' flag set in the register coalescing pass becomes invalid after virtual register rewriter pass
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14425" name="attach_14425" title="LLVM IR that reproduces the bug.">attachment 14425</a> <a href="attachment.cgi?id=14425&action=edit" title="LLVM IR that reproduces the bug.">[details]</a></span>
LLVM IR that reproduces the bug.

The register coalescing pass sets the IsDead register flag on a physical
register machine operand while re materializing a COPY instruction. But this
flag isn't cleared in the virtual register rewriter pass, when a virtual
register in one of the machine operand in a successor MBB is replaced with the
same physical register.

This behavior can be observed when running llc and printing the machine
instructions on the attached file 'hoist-common.ll' (llc -march=x86-64
-print-machineinstrs hoist-common.ll). The output after register coalescing
pass has an instruction that marks EAX as dead (%EAX<def,dead> = MOV32r0
%EFLAGS<imp-def,dead>, %AL<imp-def>) in MBB#2, but the output after virtual
register rewriter pass has a KILL instruction that uses EAX (%AL<def> = KILL
%AL, %EAX<imp-use,kill>) in MBB#3, which is a successor to MBB#2.

The commit that introduced the setting of the IsDead machine operand flag in
the re materializer in the register coalescing pass is r184002
(<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Fview-3Drevision-26revision-3D184002&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=x0t08j2GEsa6htS_1C6Yytni-ONJomRfQfDFd4t6cdI&s=Gwg4wGS8y8oAp7YBynU2cyG2vyFx7uT1w76fN2lAmsg&e=">http://llvm.org/viewvc/llvm-project?view=revision&revision=184002</a>).</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>