<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 --- - register allocation error on win64 (atom?)"
   href="http://llvm.org/bugs/show_bug.cgi?id=21743">21743</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>register allocation error on win64 (atom?)
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </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>vtjnash@gmail.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=13426" name="attach_13426" title="win64 atom llvm code fragment">attachment 13426</a> <a href="attachment.cgi?id=13426&action=edit" title="win64 atom llvm code fragment">[details]</a></span>
win64 atom llvm code fragment

it seems that some lowering pass is unaware that the RCX register is already in
use when it uses it as temporary space. I'm not quite sure how to isolate the
code that is resulting in this error – some guidance would be appreciated. I've
attached the llvm code for the function that exhibits the issue. Specifically,
the win64 calling convention specifies that the first argument to the function
is passed in %RCX. This code appears to be expecting to pass that value right
through to the first function call (julia_ht_keyindex23309) by leaving it in
the %RCX register for the next function call. However, some code emission stage
appears to be thwarting this when it uses %RCX in a temporary computation (lea
rcx)


```
$ /opt/local/bin/llc-mp-3.5 -o - win64atom.ll -disable-fp-elim
-x86-asm-syntax=intel -mcpu=atom
    .text
    .file   "win64atom.ll"
    .globl  "julia_setindex!42311"
    .align  16, 0x90
    .type   "julia_setindex!42311",@function
"julia_setindex!42311":                 # @"julia_setindex!42311"
    .cfi_startproc
# BB#0:                                 # %L
    push    rbp
.Ltmp0:
    .cfi_def_cfa_offset 16
.Ltmp1:
    .cfi_offset rbp, -16
    mov rbp, rsp
.Ltmp2:
    .cfi_def_cfa_register rbp
    push    rsi
    push    rdi
    push    rbx
    lea rsp, qword ptr [rsp - 104]
.Ltmp3:
    .cfi_offset rbx, -40
.Ltmp4:
    .cfi_offset rdi, -32
.Ltmp5:
    .cfi_offset rsi, -24
    mov rax, qword ptr [rip + jl_pgcstack]
    mov rbx, r8
    mov rdi, rdx
    mov rsi, rcx
    lea rcx, qword ptr [rbp - 88]
    xorps   xmm0, xmm0
    mov rdx, rbx
    mov qword ptr [rbp - 88], 12
    mov qword ptr [rbp - 80], rax
    movups  xmmword ptr [rbp - 72], xmm0
    mov qword ptr [rip + jl_pgcstack], rcx
                                        # kill: RCX<def> RSI<kill>
    movups  xmmword ptr [rbp - 56], xmm0
    movups  xmmword ptr [rbp - 40], xmm0
    call    julia_ht_keyindex23309@PLT
    ...
```

cross-ref: <a href="https://github.com/JuliaLang/julia/issues/9199">https://github.com/JuliaLang/julia/issues/9199</a></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>