<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 --- - SelectDAGISel::SelectAllBasicBlocks fails to legalize instructions"
   href="http://llvm.org/bugs/show_bug.cgi?id=16717">16717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SelectDAGISel::SelectAllBasicBlocks fails to legalize instructions
          </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>Windows NT
          </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>manjian2006@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=10938" name="attach_10938" title="source that llvm generates wrong code">attachment 10938</a> <a href="attachment.cgi?id=10938&action=edit" title="source that llvm generates wrong code">[details]</a></span>
source that llvm generates wrong code

compiling option:
-O0 -fPIC -target armv5te-linux-androideabi -S 1.cpp

That generates code which does pic incorrectly:
__cxx_global_var_init:
    push    {r11, lr}
    mov    r11, sp
    sub    sp, sp, #8
    ldr    r0, .LCPI0_1
=>    ldr    r1, .LCPI0_0
    ldr    r0, [r1, r0]
    bl    _ZN1HC1Ev
        ...
.LCPI0_0:
    .long    g_h(GOT)
.LCPI0_1:
    .long    _GLOBAL_OFFSET_TABLE_

The marked code apparently missing add r0,pc

And I have found -O2 generates code correctly.After examining the code 
SelectDAGISel::SelectAllBasicBlocks,I can see FastIS is activated in O0 but not
in O2,and that consume all the changes to do SelectBasicBlock.That will leave
no meaningful data to legalize the code(SDB is empty).

I guess FastIS->SelectInstruction may not do its job well.</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>