<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 --- - IfConversion adds Undef flag on use even if reg is live"
   href="https://llvm.org/bugs/show_bug.cgi?id=27987">27987</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IfConversion adds Undef flag on use even if reg is live
          </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>URL</th>
          <td>http://reviews.llvm.org/D20907
          </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>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>paulsson@linux.vnet.ibm.com
          </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>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>IfConversion will call UpdatePredRedefs() after an MI has been predicated by
target, to update the liveness tracking, and also to add implicit use operands
on MI (for the register that has become conditionally def:ed). IfConversion was
always adding these use operands with the Undef flag, which caused later passes
to get into trouble, since that register will incorrectly be considered dead
before MI.

This was discovered with SystemZ, where the following transformation would take
place where it shouldn't:

%R4L<def> = L %R15D, 440, %noreg; mem:LD4[FixedStack5]
%R4H<def> = IIHF 1000
%R4L<def> = LOCR %R10L<kill>, 14, 10, %CC<imp-use>, %R4L<imp-use,undef>
>

%R4L<def> = L %R15D, 440, %noreg; mem:LD4[FixedStack5]
%R4D<def> = LLIHL 1000
%R4L<def> = LOCR %R10L<kill>, 14, 10, %CC<imp-use>, %R4L<imp-use,undef>

LivePhysRegs thinks during the SystemZShortenInst pass that %R4L is dead at
IIHF and replaces it with an LLIHL wich overwrites %R4L. The LOCR (Load On
Condition Register) produced by IfConversion, has the bad undef flag.

For a proposed bugfix, see <a href="http://reviews.llvm.org/D20907">http://reviews.llvm.org/D20907</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>