From: Simon Pilgrim Date: Sun, 19 Feb 2017 00:03:46 +0000 (+0000) Subject: Fix 'variable set but not used' warning when assertions are disabled. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec32c779d7ebe98ce18e75fa74790524bbcadd8a;p=llvm Fix 'variable set but not used' warning when assertions are disabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295585 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp b/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp index eab6a3c58b6..c0956520de7 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp @@ -707,6 +707,7 @@ unsigned HexagonMCCodeEmitter::getMachineOpValue(MCInst const &MI, MCOperand const &MO, SmallVectorImpl &Fixups, MCSubtargetInfo const &STI) const { +#ifndef NDEBUG size_t OperandNumber = ~0U; for (unsigned i = 0, n = MI.getNumOperands(); i < n; ++i) if (&MI.getOperand(i) == &MO) { @@ -714,6 +715,7 @@ HexagonMCCodeEmitter::getMachineOpValue(MCInst const &MI, MCOperand const &MO, break; } assert((OperandNumber != ~0U) && "Operand not found"); +#endif if (HexagonMCInstrInfo::isNewValue(MCII, MI) && &MO == &MI.getOperand(HexagonMCInstrInfo::getNewValueOp(MCII, MI))) {