Silence a bunch (but not all) "variable written but not read" warnings
authorDuncan Sands <baldrick@free.fr>
Fri, 12 Aug 2011 14:54:45 +0000 (14:54 +0000)
committerDuncan Sands <baldrick@free.fr>
Fri, 12 Aug 2011 14:54:45 +0000 (14:54 +0000)
when building with assertions disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137460 91177308-0d34-0410-b5e6-96231b3b80d8

20 files changed:
include/llvm/CodeGen/LiveVariables.h
lib/Analysis/IPA/CallGraphSCCPass.cpp
lib/Analysis/LoopInfo.cpp
lib/CodeGen/LiveVariables.cpp
lib/CodeGen/RegisterScavenging.cpp
lib/CodeGen/ScheduleDAG.cpp
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/ExecutionEngine/JIT/JITEmitter.cpp
lib/Support/APFloat.cpp
lib/Target/ARM/ARMBaseRegisterInfo.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/Thumb1RegisterInfo.cpp
lib/Target/CellSPU/SPUISelLowering.cpp
lib/Target/PTX/PTXISelLowering.cpp
lib/Target/X86/X86FloatingPoint.cpp
lib/Transforms/Scalar/Reassociate.cpp
lib/Transforms/Utils/LoopSimplify.cpp
tools/llvm-diff/DifferenceEngine.cpp

index f9b81b1ea7d60b1c637b57a97c8374c115c0754c..7ba901fc28a4ebde878ecb19ad570ac2b9b94cc4 100644 (file)
@@ -231,6 +231,7 @@ public:
     }
 
     assert(Removed && "Register is not used by this instruction!");
+    (void)Removed;
     return true;
   }
 
@@ -265,6 +266,7 @@ public:
       }
     }
     assert(Removed && "Register is not defined by this instruction!");
+    (void)Removed;
     return true;
   }
   
index 659ffab0c6f00f8a0dc6397dad8403578512f212..b6f9f0b32d8da22bd6b1a633231d31eb11045972 100644 (file)
@@ -350,6 +350,7 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
            dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n";
          }
         );
+  (void)MadeChange;
 
   return DevirtualizedCall;
 }
index af35462544e7bf9848ff6c769226048181d2e687..9a7c50d7fa4492506069bf6534497b3806dfd8f6 100644 (file)
@@ -612,8 +612,8 @@ void LoopInfo::updateUnloop(Loop *Unloop) {
     }
 
     // Remove the loop from the top-level LoopInfo object.
-    for (LoopInfo::iterator I = LI.begin(), E = LI.end();; ++I) {
-      assert(I != E && "Couldn't find loop");
+    for (LoopInfo::iterator I = LI.begin();; ++I) {
+      assert(I != LI.end() && "Couldn't find loop");
       if (*I == Unloop) {
         LI.removeLoop(I);
         break;
@@ -640,8 +640,8 @@ void LoopInfo::updateUnloop(Loop *Unloop) {
 
   // Remove unloop from its parent loop.
   Loop *ParentLoop = Unloop->getParentLoop();
-  for (Loop::iterator I = ParentLoop->begin(), E = ParentLoop->end();; ++I) {
-    assert(I != E && "Couldn't find loop");
+  for (Loop::iterator I = ParentLoop->begin();; ++I) {
+    assert(I != ParentLoop->end() && "Couldn't find loop");
     if (*I == Unloop) {
       ParentLoop->removeChildLoop(I);
       break;
index 20bad60deddaee289d27e4a6b239f32ede9a6973..2ca90f9f05c089a388754bbf23677c80abd62989 100644 (file)
@@ -662,7 +662,7 @@ void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) {
       if (TargetRegisterInfo::isVirtualRegister(Reg)) {
         bool removed = getVarInfo(Reg).removeKill(MI);
         assert(removed && "kill not in register's VarInfo?");
-        removed = true;
+        (void)removed;
       }
     }
   }
index 9e9a145b0aa45ec1459070b20a500a4715624fce..ca02aa1b81436721f72eec90325ecdf7451f432e 100644 (file)
@@ -206,6 +206,7 @@ void RegScavenger::forward() {
             break;
           }
         assert(SubUsed && "Using an undefined register!");
+        (void)SubUsed;
       }
       assert((!EarlyClobberRegs.test(Reg) || MI->isRegTiedToDefOperand(i)) &&
              "Using an early clobbered register!");
index 21375b286c99a0db15ec9d6a3c6f845f94a17eba..fc68db92e2b6080f163783105599a8c106bebf6b 100644 (file)
@@ -140,6 +140,7 @@ void SUnit::removePred(const SDep &D) {
           break;
         }
       assert(FoundSucc && "Mismatching preds / succs lists!");
+      (void)FoundSucc;
       Preds.erase(I);
       // Update the bookkeeping.
       if (P.getKind() == SDep::Data) {
index acdcc4f4bdde6eec47a0234ea9d4b4bf19b6d562..b1f7fb8f85f6a5eb4229699eedc51dc950d05f09 100644 (file)
@@ -1291,8 +1291,7 @@ void DAGTypeLegalizer::FloatExpandSetCCOperands(SDValue &NewLHS,
   GetExpandedFloat(NewLHS, LHSLo, LHSHi);
   GetExpandedFloat(NewRHS, RHSLo, RHSHi);
 
-  EVT VT = NewLHS.getValueType();
-  assert(VT == MVT::ppcf128 && "Unsupported setcc type!");
+  assert(NewLHS.getValueType() == MVT::ppcf128 && "Unsupported setcc type!");
 
   // FIXME:  This generated code sucks.  We want to generate
   //         FCMPU crN, hi1, hi2
@@ -1445,6 +1444,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
                                      ST->getValue().getValueType());
   assert(NVT.isByteSized() && "Expanded type not byte sized!");
   assert(ST->getMemoryVT().bitsLE(NVT) && "Float type not round?");
+  (void)NVT;
 
   SDValue Lo, Hi;
   GetExpandedOp(ST->getValue(), Lo, Hi);
index 8747d276e7817e474e17a3ae331ecf7db7aa9294..7119769a2f010d27fb0e06145233b7574a61eaa4 100644 (file)
@@ -1969,6 +1969,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_VSETCC(SDNode *N) {
   assert(InOp1.getValueType() == WidenInVT &&
          InOp2.getValueType() == WidenInVT &&
          "Input not widened to expected type!");
+  (void)WidenInVT;
   return DAG.getNode(ISD::VSETCC, N->getDebugLoc(),
                      WidenVT, InOp1, InOp2, N->getOperand(2));
 }
index ec8f014f651c9bd00e774fe7df1073dcb9a5c49b..8e1e01099a016ce2d8546fb0d0e9e13cc64e0ce4 100644 (file)
@@ -463,6 +463,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
     GroupName = "Instruction Selection and Scheduling";
   std::string BlockName;
   int BlockNumber = -1;
+  (void)BlockNumber;
 #ifdef NDEBUG
   if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs ||
       ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs ||
index b08969197f6be24d6a5564d2d1b02fbe899b837c..24020ee6d689ed1662924a41675ac40fcb2cb0f3 100644 (file)
@@ -668,6 +668,7 @@ void *JITResolver::JITCompilerFn(void *Stub) {
     DEBUG(dbgs() << "JIT: Lazily resolving function '" << F->getName()
           << "' In stub ptr = " << Stub << " actual ptr = "
           << ActualPtr << "\n");
+    (void)ActualPtr;
 
     Result = JR->TheJIT->getPointerToFunction(F);
   }
index b37e0115468b3ce82adbe51eef6340aa9e11243b..1437fd6f81435619f789c707c55d18f3d755e8f3 100644 (file)
@@ -832,6 +832,7 @@ APFloat::incrementSignificand()
 
   /* Our callers should never cause us to overflow.  */
   assert(carry == 0);
+  (void)carry;
 }
 
 /* Add the significand of the RHS.  Returns the carry flag.  */
@@ -926,6 +927,7 @@ APFloat::multiplySignificand(const APFloat &rhs, const APFloat *addend)
     APFloat extendedAddend(*addend);
     status = extendedAddend.convert(extendedSemantics, rmTowardZero, &ignored);
     assert(status == opOK);
+    (void)status;
     lost_fraction = addOrSubtractSignificand(extendedAddend, false);
 
     /* Restore our state.  */
@@ -1389,6 +1391,7 @@ APFloat::addOrSubtractSignificand(const APFloat &rhs, bool subtract)
     /* The code above is intended to ensure that no borrow is
        necessary.  */
     assert(!carry);
+    (void)carry;
   } else {
     if (bits > 0) {
       APFloat temp_rhs(rhs);
@@ -1402,6 +1405,7 @@ APFloat::addOrSubtractSignificand(const APFloat &rhs, bool subtract)
 
     /* We have a guard bit; generating a carry cannot happen.  */
     assert(!carry);
+    (void)carry;
   }
 
   return lost_fraction;
index fe7e45f914369136e018f0bb780f59657490b6e8..d888c1da0645544235394c18ce729b1755545d2c 100644 (file)
@@ -1130,6 +1130,7 @@ ARMBaseRegisterInfo::resolveFrameIndex(MachineBasicBlock::iterator I,
     Done = rewriteT2FrameIndex(MI, i, BaseReg, Off, TII);
   }
   assert (Done && "Unable to resolve frame index!");
+  (void)Done;
 }
 
 bool ARMBaseRegisterInfo::isFrameOffsetLegal(const MachineInstr *MI,
index 4f18ce37d0da2769b89e01b4d200cc1bb97d27af..abec1aa50ef3128fb5574c725a604a18b09a2986 100644 (file)
@@ -2983,8 +2983,8 @@ static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
   EVT VT = Op.getValueType();
   DebugLoc dl = Op.getDebugLoc();
 
-  EVT OperandVT = Op.getOperand(0).getValueType();
-  assert(OperandVT == MVT::v4i16 && "Invalid type for custom lowering!");
+  assert(Op.getOperand(0).getValueType() == MVT::v4i16 &&
+         "Invalid type for custom lowering!");
   if (VT != MVT::v4f32)
     return DAG.UnrollVectorOp(Op.getNode());
 
index cb7d5b6c7d2ee32709443a7d257b5cfa6f6e2d17..107c86be70fe45e24ccd602793e946e9a03dece8 100644 (file)
@@ -544,9 +544,9 @@ Thumb1RegisterInfo::resolveFrameIndex(MachineBasicBlock::iterator I,
     ++i;
     assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
   }
-  bool Done = false;
-  Done = rewriteFrameIndex(MI, i, BaseReg, Off, TII);
+  bool Done = rewriteFrameIndex(MI, i, BaseReg, Off, TII);
   assert (Done && "Unable to resolve frame index!");
+  (void)Done;
 }
 
 /// saveScavengerRegister - Spill the register so it can be used by the
index 59337bceff59c6511030bf75b6ad7969fde167bf..1a081e9e6d7f6172a04ee668944ced23e3e90bf5 100644 (file)
@@ -2728,6 +2728,7 @@ static SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG)
   // the type to extend from needs to be i64 or i32.
   assert((OpVT == MVT::i128 && (Op0VT == MVT::i64 || Op0VT == MVT::i32)) &&
           "LowerSIGN_EXTEND: input and/or output operand have wrong size");
+  (void)OpVT;
 
   // Create shuffle mask
   unsigned mask1 = 0x10101010; // byte 0 - 3 and 4 - 7
index d52aa2a01ad20f2e942a1911f92c0c1d79ab1202..0961901c5f6172feba47f749896c1fb910d9566f 100644 (file)
@@ -361,9 +361,9 @@ PTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
 
   MachineFunction& MF = DAG.getMachineFunction();
   PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
-  const PTXSubtarget& ST = getTargetMachine().getSubtarget<PTXSubtarget>();
 
-  assert(ST.callsAreHandled() && "Calls are not handled for the target device");
+  assert(getTargetMachine().getSubtarget<PTXSubtarget>().callsAreHandled() &&
+         "Calls are not handled for the target device");
 
   // Is there a more "LLVM"-way to create a variable-length array of values?
   SDValue* ops = new SDValue[OutVals.size() + 2];
index a9b6fdd140855a25801ac8e8ac18f6b82761c224..e3461c82c7a6cc11fb0a447d336190148a9b99bc 100644 (file)
@@ -480,6 +480,7 @@ bool FPS::processBasicBlock(MachineFunction &MF, MachineBasicBlock &BB) {
       }
       dumpStack();
     );
+    (void)PrevMI;
 
     Changed = true;
   }
index e6341ae3071fdbb25ea93ab1da5eb59d8c0a919b..8f98a5b6503e15a981f3d12753fd580122bb42dc 100644 (file)
@@ -309,7 +309,7 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
     std::swap(LHS, RHS);
     bool Success = !I->swapOperands();
     assert(Success && "swapOperands failed");
-    Success = false;
+    (void)Success;
     MadeChange = true;
   } else if (RHSBO) {
     // Turn (A+B)+(C+D) -> (((A+B)+C)+D).  This guarantees the RHS is not
index 9b16c7cbe130624457ef78113dcd922d2fdb2d63..6a9976930c96d25b04be8dc179a05beab139a4f8 100644 (file)
@@ -743,6 +743,7 @@ void LoopSimplify::verifyAnalysis() const {
       }
     assert(HasIndBrPred &&
            "LoopSimplify has no excuse for missing loop header info!");
+    (void)HasIndBrPred;
   }
 
   // Indirectbr can interfere with exit block canonicalization.
@@ -757,5 +758,6 @@ void LoopSimplify::verifyAnalysis() const {
       }
     assert(HasIndBrExiting &&
            "LoopSimplify has no excuse for missing exit block info!");
+    (void)HasIndBrExiting;
   }
 }
index ba2cec2992554bbd942207b283658bb115fc9394..b240d8c5da5d1f452b0ad6630b015df9554026ee 100644 (file)
@@ -195,12 +195,12 @@ class FunctionDifferenceEngine {
     DifferenceEngine::Context C(Engine, L, R);
 
     BasicBlock::iterator LI = L->begin(), LE = L->end();
-    BasicBlock::iterator RI = R->begin(), RE = R->end();
+    BasicBlock::iterator RI = R->begin();
 
     llvm::SmallVector<std::pair<Instruction*,Instruction*>, 20> TentativePairs;
 
     do {
-      assert(LI != LE && RI != RE);
+      assert(LI != LE && RI != R->end());
       Instruction *LeftI = &*LI, *RightI = &*RI;
 
       // If the instructions differ, start the more sophisticated diff