<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 --- - Function ConstantFoldSelectInstruction doesn't handle vector select constant expression with "undefs""
   href="http://llvm.org/bugs/show_bug.cgi?id=18319">18319</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function ConstantFoldSelectInstruction doesn't handle vector select constant expression with "undefs"
          </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>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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ili.filippov@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>The problem is reproducible with LLVM trunk.

The reproducer:

; Function Attrs: nounwind
define void @function(<8 x i8>* %RET) #6 {
allocas:
  %m8.i161 = trunc <8 x i16> select (<8 x i1> <i1 true, i1 true, i1 true, i1
true, i1 true, i1 undef, i1 undef, i1 undef>, <8 x i16> <i16 -1, i16 -1, i16
-1, i16 -1, i16 -1, i16 0, i16 0, i16 0>, <8 x i16> zeroinitializer) to <8 x
i8>
  store <8 x i8> %m8.i161, <8 x i8>* %RET
  ret void
}

opt reproducer.ll -instcombine > reproducer.bc

The command fails in assert. This happens because vector select constant
expression containing "undefs" is not transformed to regular vector constant.
And then cast optimization doesn’t know how to work with it.

Particularly, in function ConstantFoldSelectInstruction const vector select is
converted to vector select only if it contains true or false value (which seems
reasonable from the first glance), but it also needs to handle "undef" somehow.</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>