<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 - Loop vectorizer assertion failure in truncateToMinimalBitwidths"
   href="https://bugs.llvm.org/show_bug.cgi?id=38110">38110</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Loop vectorizer assertion failure in truncateToMinimalBitwidths
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>uweigand@de.ibm.com
          </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=20543" name="attach_20543" title="Reduced test case">attachment 20543</a> <a href="attachment.cgi?id=20543&action=edit" title="Reduced test case">[details]</a></span>
Reduced test case

Running the attached test case through

  opt -loop-vectorize -mcpu=z13

on the s390x-ibm-linux target results in an assertion failure:

Unhandled instruction type!
UNREACHABLE executed at
/home/uweigand/llvm/llvm-head/lib/Transforms/Vectorize/LoopVectorize.cpp:3292!

The unhandled instruction at this point seems to be a phi node.

This is a reduced test case from a real-world application.  The corresponding
reduced C source code test case (same assertion failure) is:

void
test (unsigned int width, unsigned char *row,
      unsigned short src, unsigned short *dst)
{
  unsigned char *sp;
  unsigned int i;

  sp = row;
  for (i = 0; i < width; i++, sp++)
    {
      if (*sp == src)
        *sp = (unsigned char) *dst;
    }
}</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>