From 06e7de795bf19b950693b8dc86fa36f355dc6760 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 4 Jun 2021 23:34:43 -0700 Subject: [PATCH] Fix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build --- llvm/lib/Analysis/BranchProbabilityInfo.cpp | 1 + llvm/lib/AsmParser/LLParser.cpp | 1 + llvm/lib/Target/X86/X86FastISel.cpp | 1 + llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | 1 + llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | 1 + llvm/utils/TableGen/X86DisassemblerTables.cpp | 1 + 6 files changed, 6 insertions(+) diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 2bbf421..798d078 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -1191,6 +1191,7 @@ void BranchProbabilityInfo::setEdgeProbability( // should be within Probs.size / BranchProbability::getDenominator. assert(TotalNumerator <= BranchProbability::getDenominator() + Probs.size()); assert(TotalNumerator >= BranchProbability::getDenominator() - Probs.size()); + (void)TotalNumerator; } void BranchProbabilityInfo::copyEdgeProbabilities(BasicBlock *Src, diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 91599e2..7a24994 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -9177,6 +9177,7 @@ bool LLParser::parseOptionalParamAccesses( return true; CallsNum += ParamAccess.Calls.size(); assert(VContexts.size() == CallsNum); + (void)CallsNum; Params.emplace_back(std::move(ParamAccess)); } while (EatIfPresent(lltok::comma)); diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 8a6b9e7..44670a9 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -2577,6 +2577,7 @@ bool X86FastISel::TryEmitSmallMemcpy(X86AddressMode DestAM, bool RV = X86FastEmitLoad(VT, SrcAM, nullptr, Reg); RV &= X86FastEmitStore(VT, Reg, DestAM); assert(RV && "Failed to emit load or store??"); + (void)RV; unsigned Size = VT.getSizeInBits()/8; Len -= Size; diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp index b630cb4..9a3afa9 100644 --- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -234,6 +234,7 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite( for (uint32_t I = 0; I < NumCandidates; I++) { uint64_t Count = ValueDataRef[I].Count; assert(Count <= TotalCount); + (void)TotalCount; uint64_t Target = ValueDataRef[I].Value; LLVM_DEBUG(dbgs() << " Candidate " << I << " Count=" << Count << " Target_func: " << Target << "\n"); diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 651aaa3..ff7905be 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -637,6 +637,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { } assert(SplitLatchEdge && "Despite splitting all preds, failed to split latch exit?"); + (void)SplitLatchEdge; } else { // We can fold the conditional branch in the preheader, this makes things // simpler. The first step is to remove the extra edge to the Exit block. diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp index 0505c08..2d25289 100644 --- a/llvm/utils/TableGen/X86DisassemblerTables.cpp +++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp @@ -742,6 +742,7 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2, // We assume that the index can fit into uint16_t. assert(sEntryNumber < 65536U && "Index into ModRMDecision is too large for uint16_t!"); + (void)sEntryNumber; ++sTableNumber; } -- 2.7.4