<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 --- - Stackmaps liveness analysis can determine RIP is live"
   href="http://llvm.org/bugs/show_bug.cgi?id=21266">21266</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Stackmaps liveness analysis can determine RIP is live
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kmod@dropbox.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=13199" name="attach_13199" title="Test case -- reproduce with "llc rip.ll"">attachment 13199</a> <a href="attachment.cgi?id=13199&action=edit" title="Test case -- reproduce with "llc rip.ll"">[details]</a></span>
Test case -- reproduce with "llc rip.ll"

Here's a snippet of the machine ir before stackmaps liveness analysis:

BB#1: derived from LLVM BB %1, Align 4 (16 bytes)
    Live Ins: %RBP
    Predecessors according to CFG: BB#1 BB#0
        PATCHPOINT 30697712, 13, 8441600, 0, 0, <regmask>, %RSP<imp-def>,
%RAX<imp-def,dead>, ...
        %RAX<def> = MOV64rm %RIP, 1, %noreg, <ga:@edgecount>, %noreg;
mem:LD8[@edgecount]
        %RAX<def,tied1> = INC64r %RAX<kill,tied0>, %EFLAGS<imp-def,dead>
        CMP64ri32 %RAX<kill>, 10001, %EFLAGS<imp-def>
        JL_4 <BB#1>, %EFLAGS<imp-use,kill>
    Successors according to CFG: BB#2(4) BB#1(124)

And here's what happens in stackmap liveness:

********** COMPUTING STACKMAP LIVENESS: f_e1_1 **********
[snip]
****** BB  ******
   Live Registers: %RBP %EBP %BP %BPL
   JL_4 <BB#1>, %EFLAGS<imp-use,kill>
   Live Registers: %RBP %EBP %BP %BPL %EFLAGS
   CMP64ri32 %RAX<kill>, 10001, %EFLAGS<imp-def>
   Live Registers: %RBP %EBP %BP %BPL %RAX %EAX %AX %AL %AH
   %RAX<def,tied1> = INC64r %RAX<kill,tied0>, %EFLAGS<imp-def,dead>
   Live Registers: %RBP %EBP %BP %BPL %RAX %EAX %AX %AL %AH
   %RAX<def> = MOV64rm %RIP, 1, %noreg, <ga:@edgecount>, %noreg;
mem:LD8[@edgecount]
   Live Registers: %RBP %EBP %BP %BPL %RIP %EIP %IP
   PATCHPOINT 30697712, 13, 8441600, 0, 0, <regmask>, <regliveout>,
%RSP<imp-def>, %RAX<imp-def,dead>, ...
[snip]
llc:
/opt/kmod_unenc/pyston_deps/llvm-test/lib/CodeGen/TargetRegisterInfo.cpp:124:
const llvm::TargetRegisterClass*
llvm::TargetRegisterInfo::getMinimalPhysRegClass(unsigned int, llvm::EVT)
const: Assertion `BestRC && "Couldn't find the register class"' failed.

It looks like the stackmaps liveness analysis is seeing the RIP-relative load
as a usage of %RIP that establishes its liveness, which causes the stackmap
emission to fail.</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>