diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp index 0c7419fef95499..69919267aa7a50 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp @@ -2285,13 +2285,15 @@ SDValue HvxSelector::getVectorConstant(ArrayRef Data, void HvxSelector::selectExtractSubvector(SDNode *N) { SDValue Inp = N->getOperand(0); MVT ResTy = N->getValueType(0).getSimpleVT(); + auto IdxN = cast(N->getOperand(1)); + unsigned Idx = IdxN->getZExtValue(); +#ifndef NDEBUG MVT InpTy = Inp.getValueType().getSimpleVT(); assert(InpTy.getVectorElementType() == ResTy.getVectorElementType()); unsigned ResLen = ResTy.getVectorNumElements(); assert(2 * ResLen == InpTy.getVectorNumElements()); - auto IdxN = cast(N->getOperand(1)); - unsigned Idx = IdxN->getZExtValue(); assert(Idx == 0 || Idx == ResLen); +#endif unsigned SubReg = Idx == 0 ? Hexagon::vsub_lo : Hexagon::vsub_hi; SDValue Ext = DAG.getTargetExtractSubreg(SubReg, SDLoc(N), ResTy, Inp);