<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 --- - Assertion failed: (!VT.isSimple() || (unsigned)VT.getSimpleVT().SimpleTy < array_lengthof(RegClassForVT)), function isTypeLegal"
   href="http://llvm.org/bugs/show_bug.cgi?id=21548">21548</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (!VT.isSimple() || (unsigned)VT.getSimpleVT().SimpleTy < array_lengthof(RegClassForVT)), function isTypeLegal
          </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>All
          </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>grosbach@apple.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=13326" name="attach_13326" title="testcase from llvm-stress">attachment 13326</a> <a href="attachment.cgi?id=13326&action=edit" title="testcase from llvm-stress">[details]</a></span>
testcase from llvm-stress

CodeGenPrepare tries to sink shift and truncate instructions into the basic
block of their users heuristically. It fails, however, in the case of a
truncate to i1 which is then fed into a select of pointers.

  %Tr = trunc i32 %B to i1
...
  %Sl54 = select i1 %Tr, i64* %A1, i64* %2

The check in SinkShiftAndTruncate() for CodeGenPrepare.cpp calls:
if (TLI.isOperationLegalOrCustom(ISDOpcode, EVT::getEVT(TruncUser->getType(),
true)))

When the type is iPTR, that check goes badly (at least for AArch64). There's
even a relevant FIXME right above which is related.
    // If the use is actually a legal node, there will not be an                
    // implicit truncate.                                                       
    // FIXME: always querying the result type is just an                        
    // approximation; some nodes' legality is determined by the                 
    // operand or other means. There's no good way to find out though.


Either that conditional needs to handle SELECT directly (likely, since the
result type is unrelated to the heuristic when the operand from the trunc is
the conditional) and/or the lower level isTypeLegal() check should know what to
do with iPTR.</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>