[llvm] 06e7de7 - Fix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 4 23:34:48 PDT 2021


Author: Fangrui Song
Date: 2021-06-04T23:34:43-07:00
New Revision: 06e7de795bf19b950693b8dc86fa36f355dc6760

URL: https://github.com/llvm/llvm-project/commit/06e7de795bf19b950693b8dc86fa36f355dc6760
DIFF: https://github.com/llvm/llvm-project/commit/06e7de795bf19b950693b8dc86fa36f355dc6760.diff

LOG: Fix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build

Added: 
    

Modified: 
    llvm/lib/Analysis/BranchProbabilityInfo.cpp
    llvm/lib/AsmParser/LLParser.cpp
    llvm/lib/Target/X86/X86FastISel.cpp
    llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
    llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
    llvm/utils/TableGen/X86DisassemblerTables.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 2bbf4219d761..798d0785de01 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 91599e249689..7a24994579ba 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 8a6b9e75efe0..44670a9e0f31 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 b630cb46c486..9a3afa9cc924 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 651aaa331cbc..ff7905bed91d 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 0505c08a4f88..2d25289608f3 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;
 }


        


More information about the llvm-commits mailing list