[Hexagon] Put asserts in an !NDEBUG region. NFCI
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 25 Nov 2022 10:01:49 +0000 (11:01 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 25 Nov 2022 10:02:16 +0000 (11:02 +0100)
Avoids unused variables in NDEBUG builds.

llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp

index 0c7419f..6991926 100644 (file)
@@ -2285,13 +2285,15 @@ SDValue HvxSelector::getVectorConstant(ArrayRef<uint8_t> Data,
 void HvxSelector::selectExtractSubvector(SDNode *N) {
   SDValue Inp = N->getOperand(0);
   MVT ResTy = N->getValueType(0).getSimpleVT();
+  auto IdxN = cast<ConstantSDNode>(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<ConstantSDNode>(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);