[llvm] [LoopUnroll] Fix unused variable warning (PR #178490)

Walter Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 11:13:18 PST 2026


https://github.com/googlewalt created https://github.com/llvm/llvm-project/pull/178490

Fixes 362c39d36dd87c5659b0caa3115dfa67f592cdf6.

>From f5d1df25ce863f1f17eb5428fad8f36054cbb38b Mon Sep 17 00:00:00 2001
From: Walter Lee <waltl at google.com>
Date: Wed, 28 Jan 2026 14:11:46 -0500
Subject: [PATCH] [LoopUnroll] Fix unused variable warning

Fixes 362c39d36dd87c5659b0caa3115dfa67f592cdf6.
---
 llvm/lib/Transforms/Utils/LoopUtils.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index e5bc2e50ae7f3..437465b30e1c2 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1027,14 +1027,14 @@ BranchProbability llvm::getBranchProbability(BasicBlock *Src, BasicBlock *Dst) {
   if (!TI || TI->getNumSuccessors() == 0)
     return BranchProbability::getZero();
 
-  auto NumSucc = TI->getNumSuccessors();
   SmallVector<uint32_t, 4> Weights;
 
   if (!extractBranchWeights(*TI, Weights)) {
     // No metadata
     return BranchProbability::getUnknown();
   }
-  assert(NumSucc == Weights.size() && "Missing weights in branch_weights");
+  assert(TI->getNumSuccessors() == Weights.size() &&
+         "Missing weights in branch_weights");
 
   uint64_t Total = 0;
   uint32_t Numerator = 0;



More information about the llvm-commits mailing list