<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Redundant instruction injected after the rdtsc instruction"
   href="http://llvm.org/bugs/show_bug.cgi?id=20881">20881</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Redundant instruction injected after the rdtsc instruction
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yuri@tsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>