[LLVMbugs] [Executable Attachment Removed] [Bug 15705] New: Unneeded register-register move emitted for x86_64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 8 15:10:19 PDT 2013


            Bug ID: 15705
           Summary: Unneeded register-register move emitted for x86_64
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Using r179060, the following ll code generates an extra mov instruction:

target datalayout =
target triple = "x86_64-apple-macosx10.8.0"

define i32 @fun(i32 %x, i32 %a, i32 %b, i32 %c) #0 {
  %cmp = icmp eq i32 %x, %a
  br i1 %cmp, label %return, label %if.end

if.end:                                           ; preds = %entry
  %cmp1 = icmp eq i32 %x, %b
  %c.a = select i1 %cmp1, i32 %c, i32 %a
  br label %return

return:                                           ; preds = %if.end, %entry
  %retval.0 = phi i32 [ %b, %entry ], [ %c.a, %if.end ]
  ret i32 %retval.0

attributes #0 = { nounwind readnone ssp "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false"
"use-soft-float"="false" }

## BB#0:                                ## %entry
    cmpl    %esi, %edi
    jne    LBB0_2
## BB#1:
    movl    %edx, %esi
    movl    %esi, %eax
LBB0_2:                                 ## %if.end
    cmpl    %edx, %edi
    cmovel    %ecx, %esi
    movl    %esi, %eax

Note the sequence in BB#1
edx -> esi, esi-> eax could just be edx -> eax

You are receiving this mail because:
You are on the CC list for the bug.

More information about the llvm-bugs mailing list