[LLVMbugs] [Bug 4420] New: Missed const propagation from condition of branch to phi node at landing

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jun 19 18:08:07 PDT 2009


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

           Summary: Missed const propagation from condition of branch to phi
                    node at landing
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, nlewycky at google.com


Created an attachment (id=3110)
 --> (http://llvm.org/bugs/attachment.cgi?id=3110)
Assembly with missed optimization.

In the following assembly (which doesn't change under head's `opt -O3`:

declare i1 @ext()
define i1 @foo() {
entry:
        %cond = tail call i1 @ext()             ; <i1> [#uses=2]
        br i1 %cond, label %bb1, label %bb2

bb1:            ; preds = %entry
        %cond2 = tail call i1 @ext()            ; <i1> [#uses=1]
        br i1 %cond2, label %bb3, label %bb2

bb2:            ; preds = %bb1, %entry
        %cond_merge = phi i1 [ %cond, %entry ], [ false, %bb1 ]         ; <i1>
[#uses=1]
        ret i1 %cond_merge

bb3:            ; preds = %bb1
        %res = tail call i1 @ext()              ; <i1> [#uses=1]
        ret i1 %res
}



%entry has "br i1 %cond, label %bb1, label %bb2". If this jumps to %bb2, we
know %cond was false. But %bb2 has "%cond_merge = phi i1 [ %cond, %entry ]...",
in which it could have inlined %cond as false.


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