Continued from: https://bugs.llvm.org//show_bug.cgi?id=32422
About the assert in LegalizeOp() that triggered:
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.
I wonder why both getTypeAction() and isTypeLegal() are called here - shouldn't they be equivalent?
Follow up question is then If the patch looks reasonable: is it enough with just isTypeLegal()?
I also removed the check
if (Ops.size() == LegalVT.getVectorNumElements())
since it seems redundant with
if (ISD::isBuildVectorOfConstantSDNodes(N1.getNode()))
The getScalarType() here is redundant: the type of N1C must be an integer type.