[LLVMbugs] [Bug 21468] New: GVN should be able to sink instruction into the latch

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 3 14:01:20 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21468

            Bug ID: 21468
           Summary: GVN should be able to sink instruction into the latch
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141103/253e1f59/attachment.html>


More information about the llvm-bugs mailing list