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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to