<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 --- - miscompilation: %rbx is reused across cpuid"
   href="http://llvm.org/bugs/show_bug.cgi?id=17907">17907</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>miscompilation: %rbx is reused across cpuid
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kcc@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11531" name="attach_11531" title="bug.ll">attachment 11531</a> <a href="attachment.cgi?id=11531&action=edit" title="bug.ll">[details]</a></span>
bug.ll

I have a cpuid function implemented like this: 

void __cpuid(int cpu_info[4], int info_type) {                                  
  __asm__ volatile("cpuid \n\t"                                                 
                   : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]),   
                     "=d"(cpu_info[3])                                          
                   : "a"(info_type));                                           
}

The asm constraints look correct -- they say that the instruction clobbers %rbx
However in some circumstances, the codegen doesn't seem to honor this.
This happens when I build a .cc files with locally modified AddressSanitizer.
I don't have a proper .cc example, only a .ll example:

% llc bug.ll 
        pushq   %rbx
...
        movq    %rsp, %rbx
...
        cpuid
        movq    128(%rbx), %rsi

Here %rbx is used right after cpuid which clobbers %rbx

So far I was not able to reproduce this bug w/o my local modification in
AddressSanitizer. 

Any suggestion?</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>