<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 - llvm-stress causes DAGCombiner to produce an illegal BUILD_VECTOR"
   href="https://bugs.llvm.org/show_bug.cgi?id=32422">32422</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-stress causes DAGCombiner to produce an illegal BUILD_VECTOR
          </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>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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.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=18170" name="attach_18170" title="reduced llvm-stress test case">attachment 18170</a> <a href="attachment.cgi?id=18170&action=edit" title="reduced llvm-stress test case">[details]</a></span>
reduced llvm-stress test case

A nonsense function:

*** IR Dump After Module Verifier ***
define void @autogen_SD28844() #0 {
BB:
  %I = insertelement <8 x i8> zeroinitializer, i8 -95, i32 3
  %I8 = insertelement <8 x i8> zeroinitializer, i8 -119, i32 2
  %FC = uitofp <8 x i8> %I8 to <8 x float>
  %Cmp18 = fcmp uno <8 x float> zeroinitializer, %FC
  %I22 = insertelement <8 x i1> %Cmp18, i1 true, i32 5
  br label %CF

CF:                                               ; preds = %CF, %BB
  %Cmp40 = fcmp uno double 0xC663C682E9619F00, undef
  br i1 %Cmp40, label %CF, label %CF353

CF353:                                            ; preds = %CF
  %E195 = extractelement <8 x i1> %I22, i32 4
  ret void
}

causes ISel to crash:

DAGCombiner transforms

26: DAG.dump() = SelectionDAG has 10 nodes:
    t0: ch = EntryToken
        t64: v8i16 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>
      t66: v8i16 = sign_extend_inreg t64, ValueType:ch:v8i1
    t34: v8i16 = insert_vector_elt t66, Constant:i32<1>, Constant:i32<5>
  t19: ch = CopyToReg t0, Register:v8i16 %vreg0, t34

to

26: DAG.dump() = SelectionDAG has 8 nodes:
    t0: ch = EntryToken
      t76: v8i16 = BUILD_VECTOR Constant:i16<0>, Constant:i16<0>,
Constant:i16<0>, Constant:i16<0>, Constant:i16<0>, Constant:i16<0>,
Constant:i16<0>, Constant:i16<0>
    t34: v8i16 = insert_vector_elt t76, Constant:i32<1>, Constant:i32<5>
  t19: ch = CopyToReg t0, Register:v8i16 %vreg0, t34

, which later triggers (on BUILD_VECTOR)

/llvm/llvm-dev/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:921: void
{anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion
`(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) ==
TargetLowering::TypeLegal || TLI.isTypeLegal(Op.getValueType()) ||
Op.getOpcode() == ISD::TargetConstant) && "Unexpected illegal type!"' failed.

This is because i16 is not a legal type on SystemZ, which means the
BUILD_VECTOR was transformed incorrectly. Could it be that the BUILD_VECTOR
should have TargetConstant operands, instead of Constant operands?

run with
bin/llc -mtriple=s390x-linux-gnu -mcpu=z13</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>