<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 --- - DAGCombiner does not check for legal ExtLoad operation before folding (aext (zextload x)) -> (aext (truncate (*extload x)))"
   href="http://llvm.org/bugs/show_bug.cgi?id=19348">19348</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DAGCombiner does not check for legal ExtLoad operation before folding (aext (zextload x)) -> (aext (truncate (*extload x)))
          </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>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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>stanislav.mekhanoshin@amd.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>Our custom BE does not support extloads from i8 and i16 right into i64, but
there are no legal i8 and i16 types either, only i32 and i64 are legal. So we
have custom lowering for such loads which does extload from a sub-dword type to
i32 register and then generates extension from i32 to i64. This is the only way
the HW can do this is fact.

The DAGCombiner detects double extension and folds it back to a single
extending load from a sub-dword to i64, which is marked by BE as custom, not
legal. This results in "cannot select" error. Custom lowering is not called
anymore after the legalization (if it does that would incur an endless loop, I
suppose).

The working solution is to check in DAGCombiner if a requested ext load
operation is legal and do not perform optimization if it is not.

Both zext and sext cases are guarded with such check, but not aext.</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>