[LLVMbugs] [Bug 4413] New: Missed optimization in select on correlated phi nodes

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jun 18 23:20:13 PDT 2009


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

           Summary: Missed optimization in select on correlated phi nodes
           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


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

`opt -O3` at head fails to optimize the following function:

declare i32 @ext()

define i32 @foo(i1 %a) {
entry:
        br i1 %a, label %bb1, label %bb2

bb1:            ; preds = %entry
        %0 = tail call i32 @ext()               ; <i32> [#uses=1]
        br label %bb2

bb2:            ; preds = %bb1, %entry
        %cond = phi i1 [ true, %bb1 ], [ false, %entry ]                ; <i1>
[#uses=1]
        %val = phi i32 [ %0, %bb1 ], [ 0, %entry ]              ; <i32>
[#uses=1]
        %res = select i1 %cond, i32 %val, i32 0         ; <i32> [#uses=1]
        ret i32 %res
}


Despite the fact that %res is equal to %val for every in-edge to %bb2, so the
select could be removed.


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