<html>
    <head>
      <base href="http://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 --- - GVN should be able to sink instruction into the latch"
   href="http://llvm.org/bugs/show_bug.cgi?id=21468">21468</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GVN should be able to sink instruction into the latch
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@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>The following used to be optimized by FoldOpIntoPhi before r221187 but this
stopped being the case after it was determine that permitting FoldOpIntoPhi to
insert instructions that the PHI may reach will lead to infinite loops. 
Perhaps GVN should catch this instead.

; CHECK: fold_phi
define float @fold_phi(float %a) nounwind {
entry:
  br label %for.body

for.body:
; CHECK: phi float
; CHECK-NEXT: br i1 undef
  %sum.057 = phi float [ 0.000000e+00, %entry ], [ %add5, %bb0 ]
  %add5 = fadd float %sum.057, 1.0 ;; Should be moved to the latch!
  br i1 undef, label %bb0, label %end

; CHECK: bb0:
bb0:
; CHECK: fadd float
  br label %for.body

end:
  ret float %add5
}</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>