[LLVMbugs] [Bug 14854] New: LICM pass doesn't hoist out insertvalue/extractvalue instructions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 8 12:09:06 PST 2013


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

             Bug #: 14854
           Summary: LICM pass doesn't hoist out insertvalue/extractvalue
                    instructions
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: WheretIB at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


LICM pass doesn't recognize insertvalue/extractvalue instructions as hoistable
and a possible optimization is missed.

For example, compilation of this code using opt -basicaa -licm doesn't change
anything even though the
%out = extractvalue { i32*, i32 } %0, 1
can be moved outside the loop:

define internal i32 @test(i32 %i, { i32*, i32 }* noalias nocapture byval %e) {
entry:
  %0 = load { i32*, i32 }* %e, align 4, !invariant.load !0

  br label %tailrecurse

tailrecurse:                                      ; preds = %then, %entry
  %i.tr = phi i32 [ %i, %entry ], [ %2, %then ]
  %out = extractvalue { i32*, i32 } %0, 1
  %1 = icmp sgt i32 %out, %i.tr
  br i1 %1, label %then, label %ifend

then:                                             ; preds = %tailrecurse
  %2 = add i32 %i.tr, 1
  br label %tailrecurse

ifend:                                            ; preds = %tailrecurse
  ret i32 0
}

!0 = metadata !{}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list