[LLVMbugs] [Bug 13590] New: Select condition not propagated to values

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 12 15:04:54 PDT 2012


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

             Bug #: 13590
           Summary: Select condition not propagated to values
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code is not optimized 

define i32 @f(i1 %X) {
entry:
  %ext = zext i1 %X to i32
  %res = select i1 %X, i32 %ext, i32 1
  ret i32 %res
}

but the equivalent one using phis is:

define i32 @f(i1 %X) {
entry:
  br i1 %X, label %truel, label %falsel
  truel:
  %ext = zext i1 %X to i32
  br label %end
  falsel:
  br label %end
  end:
  %res = phi i32 [ %ext, %truel], [ 1, %falsel]
  ret i32 %res
}

is converted by gvn into

define i32 @f(i1 %X) {
entry:
  br i1 %X, label %truel, label %falsel

truel:                                            ; preds = %entry
  br label %end

falsel:                                           ; preds = %entry
  br label %end

end:                                              ; preds = %falsel, %truel
  ret i32 1
}

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