]> granicus.if.org Git - llvm/commitdiff
Fix 'variable set but not used' warning when assertions are disabled.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Feb 2017 00:03:46 +0000 (00:03 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Feb 2017 00:03:46 +0000 (00:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295585 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp

index eab6a3c58b692aa588cc86fa727f15d0cda72d76..c0956520de738a6b6eacbc010bc8a0dd1c6c5032 100644 (file)
@@ -707,6 +707,7 @@ unsigned
 HexagonMCCodeEmitter::getMachineOpValue(MCInst const &MI, MCOperand const &MO,
                                         SmallVectorImpl<MCFixup> &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))) {