[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


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

            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 =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"

define i32 @fun(i32 %x, i32 %a, i32 %b, i32 %c) #0 {
entry:
  %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" }

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


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