[LLVMbugs] [Bug 2581] New: Useless select not removed

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jul 22 07:52:28 PDT 2008


           Summary: Useless select not removed
           Product: new-bugs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matthijs at stdin.nl
                CC: llvmbugs at cs.uiuc.edu

In the following fairly trivial program, the select is obviously completely
useless. However, it is not removed when running opt -std-compile-opts.

define i32 @run(i1 %C) nounwind  {
        br i1 %C, label %exit, label %body

body:           ; preds = %0
        %A = select i1 %C, i32 10, i32 11               ; <i32> [#uses=1]
        ret i32 %A

exit:           ; preds = %0
        ret i32 10

If I do a conditional branch instead of a select, simplifycfg seems to catch
that and remove the conditional. It makes sense that simlifycfg doesn't remove
a select, but I'm not sure which pass should catch this. I guess SCCP or
CondProp would be a good condidate?

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