<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ARMConstantIslandPass.cpp:350: llvm_unreachable 'Constant pool entry out of range!' in Thumb1 mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=36658">36658</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ARMConstantIslandPass.cpp:350: llvm_unreachable 'Constant pool entry out of range!' in Thumb1 mode
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>apazos@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20026" name="attach_20026" title="failing test case">attachment 20026</a> <a href="attachment.cgi?id=20026&action=edit" title="failing test case">[details]</a></span>
failing test case

ARMConstantIslands::verify() fails with the attached Thumb1 test case.

2 TBBs are inserted by optimizeThumb2JumpTables() as expected and the BB sizes
look correct, but when isCPEntryInRange() computes UserOffset and CPEOffset,
CPEOffset turns out to be smaller then UserOffset, causing verify() to fail.

I understand the pass tries to synthesize Thumb1 TBB like it does Thumb2 TBB,
but there is no hardware instruction in Thumb1, and Thumb1 TBB
pseudoinstruction is later lowered to a sequence of  4 instructions.

tTBB_JT/tTBH_JT pseudoinstructions are defined with Size=2, while 
t2TBB_JT/t2TBH_JT pseudoinstructions are defined with Size=4. If I force
tTBB_JT pseudoinstruction Size=4, just like Thumb2, the issue is gone.

How to reproduce:
run llc bug-tbb-opt.ll -debug-only=arm-cp-islands</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>