[LLVMbugs] [Bug 1777] New: Optimizer not handling phi nodes for specific control flow

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Nov 4 23:49:07 PST 2007


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

           Summary: Optimizer not handling phi nodes for specific control
                    flow
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


target datalayout = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32"

declare i1 @rrr()

define i1 @zxcv() {
entry:
%a = alloca i32
%i = ptrtoint i32* %a to i32
%b = call i1 @rrr()
br i1 %b, label %one, label %two

one:
%x = phi i32 [%i, %entry], [%y, %two]
%c = call i1 @rrr()
br i1 %c, label %two, label %end

two:
%y = phi i32 [%i, %entry], [%x, %one]
%d = call i1 @rrr()
br i1 %d, label %one, label %end

end:
%f = phi i32 [ %x, %one], [%y, %two]
; Change the %f to %i, and the optimizer suddenly becomes a lot smarter
; even though %f must equal %i at this point
%g = inttoptr i32 %f to i32*
store i32 10, i32* %g
%z = call i1 @rrr()
ret i1 %z
}

opt -std-compile-opts does nothing to this code, whereas if the %f is changed
to %i, the alloca+inttoptr+ptrtoint+store+phi all get eliminated.

I'm not sure how the optimizer should be dealing with this.


-- 
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