Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Redundant instruction injected after the assembly block #20880

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR20881
Status NEW
Importance P normal
Reported by Yuri (yuri@tsoft.com)
Reported on 2014-09-08 16:39:17 -0700
Last modified on 2014-09-08 16:44:34 -0700
Version trunk
Hardware PC FreeBSD
CC dgregor@apple.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments run-rdtsc.sh (250 bytes, text/plain)
Blocks
Blocked by
See also
In the attached case redundant instruction "movl    %eax, %eax" is generated
that isn't needed.
I think this is maybe because of the preceding assembly.

$ sh run-rdts.sh
        .text
        .file   "rdtsc.c"
        .globl  do_rdtsc
        .align  16, 0x90
        .type   do_rdtsc,@function
do_rdtsc:                               # @do_rdtsc
        .cfi_startproc
# BB#0:
        pushq   %rbp
.Ltmp0:
        .cfi_def_cfa_offset 16
.Ltmp1:
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
.Ltmp2:
        .cfi_def_cfa_register %rbp
        #APP
        rdtsc
        #NO_APP
                                        # kill: EDX<def> EDX<kill> RDX<def>
        shlq    $32, %rdx
        movl    %eax, %eax
        orq     %rdx, %rax
        popq    %rbp
        retq
.Ltmp3:
        .size   do_rdtsc, .Ltmp3-do_rdtsc
        .cfi_endproc

        .ident  "clang version 3.6.0 (trunk 215999)"
        .section        ".note.GNU-stack","",@progbits
Quuxplusone commented 10 years ago

Attached run-rdtsc.sh (250 bytes, text/plain): testcase

Quuxplusone commented 10 years ago

observed in rev.215999