Silence a bunch (but not all) "variable written but not read" warnings

when building with assertions disabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2011-08-12 14:54:45 +00:00
parent 3c757ef2ef
commit 1f6a329f79
20 changed files with 33 additions and 16 deletions

View File

@ -231,6 +231,7 @@ public:
} }
assert(Removed && "Register is not used by this instruction!"); assert(Removed && "Register is not used by this instruction!");
(void)Removed;
return true; return true;
} }
@ -265,6 +266,7 @@ public:
} }
} }
assert(Removed && "Register is not defined by this instruction!"); assert(Removed && "Register is not defined by this instruction!");
(void)Removed;
return true; return true;
} }

View File

@ -350,6 +350,7 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n";
} }
); );
(void)MadeChange;
return DevirtualizedCall; return DevirtualizedCall;
} }

View File

@ -612,8 +612,8 @@ void LoopInfo::updateUnloop(Loop *Unloop) {
} }
// Remove the loop from the top-level LoopInfo object. // Remove the loop from the top-level LoopInfo object.
for (LoopInfo::iterator I = LI.begin(), E = LI.end();; ++I) { for (LoopInfo::iterator I = LI.begin();; ++I) {
assert(I != E && "Couldn't find loop"); assert(I != LI.end() && "Couldn't find loop");
if (*I == Unloop) { if (*I == Unloop) {
LI.removeLoop(I); LI.removeLoop(I);
break; break;
@ -640,8 +640,8 @@ void LoopInfo::updateUnloop(Loop *Unloop) {
// Remove unloop from its parent loop. // Remove unloop from its parent loop.
Loop *ParentLoop = Unloop->getParentLoop(); Loop *ParentLoop = Unloop->getParentLoop();
for (Loop::iterator I = ParentLoop->begin(), E = ParentLoop->end();; ++I) { for (Loop::iterator I = ParentLoop->begin();; ++I) {
assert(I != E && "Couldn't find loop"); assert(I != ParentLoop->end() && "Couldn't find loop");
if (*I == Unloop) { if (*I == Unloop) {
ParentLoop->removeChildLoop(I); ParentLoop->removeChildLoop(I);
break; break;

View File

@ -662,7 +662,7 @@ void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) {
if (TargetRegisterInfo::isVirtualRegister(Reg)) { if (TargetRegisterInfo::isVirtualRegister(Reg)) {
bool removed = getVarInfo(Reg).removeKill(MI); bool removed = getVarInfo(Reg).removeKill(MI);
assert(removed && "kill not in register's VarInfo?"); assert(removed && "kill not in register's VarInfo?");
removed = true; (void)removed;
} }
} }
} }

View File

@ -206,6 +206,7 @@ void RegScavenger::forward() {
break; break;
} }
assert(SubUsed && "Using an undefined register!"); assert(SubUsed && "Using an undefined register!");
(void)SubUsed;
} }
assert((!EarlyClobberRegs.test(Reg) || MI->isRegTiedToDefOperand(i)) && assert((!EarlyClobberRegs.test(Reg) || MI->isRegTiedToDefOperand(i)) &&
"Using an early clobbered register!"); "Using an early clobbered register!");

View File

@ -140,6 +140,7 @@ void SUnit::removePred(const SDep &D) {
break; break;
} }
assert(FoundSucc && "Mismatching preds / succs lists!"); assert(FoundSucc && "Mismatching preds / succs lists!");
(void)FoundSucc;
Preds.erase(I); Preds.erase(I);
// Update the bookkeeping. // Update the bookkeeping.
if (P.getKind() == SDep::Data) { if (P.getKind() == SDep::Data) {

View File

@ -1291,8 +1291,7 @@ void DAGTypeLegalizer::FloatExpandSetCCOperands(SDValue &NewLHS,
GetExpandedFloat(NewLHS, LHSLo, LHSHi); GetExpandedFloat(NewLHS, LHSLo, LHSHi);
GetExpandedFloat(NewRHS, RHSLo, RHSHi); GetExpandedFloat(NewRHS, RHSLo, RHSHi);
EVT VT = NewLHS.getValueType(); assert(NewLHS.getValueType() == MVT::ppcf128 && "Unsupported setcc type!");
assert(VT == MVT::ppcf128 && "Unsupported setcc type!");
// FIXME: This generated code sucks. We want to generate // FIXME: This generated code sucks. We want to generate
// FCMPU crN, hi1, hi2 // FCMPU crN, hi1, hi2
@ -1445,6 +1444,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
ST->getValue().getValueType()); ST->getValue().getValueType());
assert(NVT.isByteSized() && "Expanded type not byte sized!"); assert(NVT.isByteSized() && "Expanded type not byte sized!");
assert(ST->getMemoryVT().bitsLE(NVT) && "Float type not round?"); assert(ST->getMemoryVT().bitsLE(NVT) && "Float type not round?");
(void)NVT;
SDValue Lo, Hi; SDValue Lo, Hi;
GetExpandedOp(ST->getValue(), Lo, Hi); GetExpandedOp(ST->getValue(), Lo, Hi);

View File

@ -1969,6 +1969,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_VSETCC(SDNode *N) {
assert(InOp1.getValueType() == WidenInVT && assert(InOp1.getValueType() == WidenInVT &&
InOp2.getValueType() == WidenInVT && InOp2.getValueType() == WidenInVT &&
"Input not widened to expected type!"); "Input not widened to expected type!");
(void)WidenInVT;
return DAG.getNode(ISD::VSETCC, N->getDebugLoc(), return DAG.getNode(ISD::VSETCC, N->getDebugLoc(),
WidenVT, InOp1, InOp2, N->getOperand(2)); WidenVT, InOp1, InOp2, N->getOperand(2));
} }

View File

@ -463,6 +463,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
GroupName = "Instruction Selection and Scheduling"; GroupName = "Instruction Selection and Scheduling";
std::string BlockName; std::string BlockName;
int BlockNumber = -1; int BlockNumber = -1;
(void)BlockNumber;
#ifdef NDEBUG #ifdef NDEBUG
if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs || if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs ||
ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs || ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs ||

View File

@ -668,6 +668,7 @@ void *JITResolver::JITCompilerFn(void *Stub) {
DEBUG(dbgs() << "JIT: Lazily resolving function '" << F->getName() DEBUG(dbgs() << "JIT: Lazily resolving function '" << F->getName()
<< "' In stub ptr = " << Stub << " actual ptr = " << "' In stub ptr = " << Stub << " actual ptr = "
<< ActualPtr << "\n"); << ActualPtr << "\n");
(void)ActualPtr;
Result = JR->TheJIT->getPointerToFunction(F); Result = JR->TheJIT->getPointerToFunction(F);
} }

View File

@ -832,6 +832,7 @@ APFloat::incrementSignificand()
/* Our callers should never cause us to overflow. */ /* Our callers should never cause us to overflow. */
assert(carry == 0); assert(carry == 0);
(void)carry;
} }
/* Add the significand of the RHS. Returns the carry flag. */ /* 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); APFloat extendedAddend(*addend);
status = extendedAddend.convert(extendedSemantics, rmTowardZero, &ignored); status = extendedAddend.convert(extendedSemantics, rmTowardZero, &ignored);
assert(status == opOK); assert(status == opOK);
(void)status;
lost_fraction = addOrSubtractSignificand(extendedAddend, false); lost_fraction = addOrSubtractSignificand(extendedAddend, false);
/* Restore our state. */ /* 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 /* The code above is intended to ensure that no borrow is
necessary. */ necessary. */
assert(!carry); assert(!carry);
(void)carry;
} else { } else {
if (bits > 0) { if (bits > 0) {
APFloat temp_rhs(rhs); 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. */ /* We have a guard bit; generating a carry cannot happen. */
assert(!carry); assert(!carry);
(void)carry;
} }
return lost_fraction; return lost_fraction;

View File

@ -1130,6 +1130,7 @@ ARMBaseRegisterInfo::resolveFrameIndex(MachineBasicBlock::iterator I,
Done = rewriteT2FrameIndex(MI, i, BaseReg, Off, TII); Done = rewriteT2FrameIndex(MI, i, BaseReg, Off, TII);
} }
assert (Done && "Unable to resolve frame index!"); assert (Done && "Unable to resolve frame index!");
(void)Done;
} }
bool ARMBaseRegisterInfo::isFrameOffsetLegal(const MachineInstr *MI, bool ARMBaseRegisterInfo::isFrameOffsetLegal(const MachineInstr *MI,

View File

@ -2983,8 +2983,8 @@ static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
EVT VT = Op.getValueType(); EVT VT = Op.getValueType();
DebugLoc dl = Op.getDebugLoc(); DebugLoc dl = Op.getDebugLoc();
EVT OperandVT = Op.getOperand(0).getValueType(); assert(Op.getOperand(0).getValueType() == MVT::v4i16 &&
assert(OperandVT == MVT::v4i16 && "Invalid type for custom lowering!"); "Invalid type for custom lowering!");
if (VT != MVT::v4f32) if (VT != MVT::v4f32)
return DAG.UnrollVectorOp(Op.getNode()); return DAG.UnrollVectorOp(Op.getNode());

View File

@ -544,9 +544,9 @@ Thumb1RegisterInfo::resolveFrameIndex(MachineBasicBlock::iterator I,
++i; ++i;
assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
} }
bool Done = false; bool Done = rewriteFrameIndex(MI, i, BaseReg, Off, TII);
Done = rewriteFrameIndex(MI, i, BaseReg, Off, TII);
assert (Done && "Unable to resolve frame index!"); assert (Done && "Unable to resolve frame index!");
(void)Done;
} }
/// saveScavengerRegister - Spill the register so it can be used by the /// saveScavengerRegister - Spill the register so it can be used by the

View File

@ -2728,6 +2728,7 @@ static SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG)
// the type to extend from needs to be i64 or i32. // the type to extend from needs to be i64 or i32.
assert((OpVT == MVT::i128 && (Op0VT == MVT::i64 || Op0VT == MVT::i32)) && assert((OpVT == MVT::i128 && (Op0VT == MVT::i64 || Op0VT == MVT::i32)) &&
"LowerSIGN_EXTEND: input and/or output operand have wrong size"); "LowerSIGN_EXTEND: input and/or output operand have wrong size");
(void)OpVT;
// Create shuffle mask // Create shuffle mask
unsigned mask1 = 0x10101010; // byte 0 - 3 and 4 - 7 unsigned mask1 = 0x10101010; // byte 0 - 3 and 4 - 7

View File

@ -361,9 +361,9 @@ PTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
MachineFunction& MF = DAG.getMachineFunction(); MachineFunction& MF = DAG.getMachineFunction();
PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>(); 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? // Is there a more "LLVM"-way to create a variable-length array of values?
SDValue* ops = new SDValue[OutVals.size() + 2]; SDValue* ops = new SDValue[OutVals.size() + 2];

View File

@ -480,6 +480,7 @@ bool FPS::processBasicBlock(MachineFunction &MF, MachineBasicBlock &BB) {
} }
dumpStack(); dumpStack();
); );
(void)PrevMI;
Changed = true; Changed = true;
} }

View File

@ -309,7 +309,7 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
std::swap(LHS, RHS); std::swap(LHS, RHS);
bool Success = !I->swapOperands(); bool Success = !I->swapOperands();
assert(Success && "swapOperands failed"); assert(Success && "swapOperands failed");
Success = false; (void)Success;
MadeChange = true; MadeChange = true;
} else if (RHSBO) { } else if (RHSBO) {
// Turn (A+B)+(C+D) -> (((A+B)+C)+D). This guarantees the RHS is not // Turn (A+B)+(C+D) -> (((A+B)+C)+D). This guarantees the RHS is not

View File

@ -743,6 +743,7 @@ void LoopSimplify::verifyAnalysis() const {
} }
assert(HasIndBrPred && assert(HasIndBrPred &&
"LoopSimplify has no excuse for missing loop header info!"); "LoopSimplify has no excuse for missing loop header info!");
(void)HasIndBrPred;
} }
// Indirectbr can interfere with exit block canonicalization. // Indirectbr can interfere with exit block canonicalization.
@ -757,5 +758,6 @@ void LoopSimplify::verifyAnalysis() const {
} }
assert(HasIndBrExiting && assert(HasIndBrExiting &&
"LoopSimplify has no excuse for missing exit block info!"); "LoopSimplify has no excuse for missing exit block info!");
(void)HasIndBrExiting;
} }
} }

View File

@ -195,12 +195,12 @@ class FunctionDifferenceEngine {
DifferenceEngine::Context C(Engine, L, R); DifferenceEngine::Context C(Engine, L, R);
BasicBlock::iterator LI = L->begin(), LE = L->end(); 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; llvm::SmallVector<std::pair<Instruction*,Instruction*>, 20> TentativePairs;
do { do {
assert(LI != LE && RI != RE); assert(LI != LE && RI != R->end());
Instruction *LeftI = &*LI, *RightI = &*RI; Instruction *LeftI = &*LI, *RightI = &*RI;
// If the instructions differ, start the more sophisticated diff // If the instructions differ, start the more sophisticated diff