[llvm] [AArch64] Fix unused-variable warning for non-dbg builds. (PR #143175)

Chenguang Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 10:25:47 PDT 2025


https://github.com/wecing created https://github.com/llvm/llvm-project/pull/143175

AArch64ISelLowering.cpp currently fails -Wunused-variable because SrcVT is only used in assert(), so it is an unused variable if not using debug builds. This behavior was introduced in 2c0a2261.

>From b5c0f0f7a4cfb6a8287969c00644725aa2381e26 Mon Sep 17 00:00:00 2001
From: Chenguang Wang <w3cing at gmail.com>
Date: Fri, 6 Jun 2025 10:22:38 -0700
Subject: [PATCH] [AArch64] Fix unused-variable warning for non-dbg builds.

AArch64ISelLowering.cpp currently fails -Wunused-variable because
SrcVT is only used in assert(), so it is an unused variable if not
using debug builds. This behavior was introduced in 2c0a2261.
---
 llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 724e3eac3b69e..379f07e14948c 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -11040,8 +11040,7 @@ SDValue AArch64TargetLowering::LowerSETCCCARRY(SDValue Op,
 static SDValue emitVectorComparison(SDValue LHS, SDValue RHS,
                                     AArch64CC::CondCode CC, bool NoNans, EVT VT,
                                     const SDLoc &DL, SelectionDAG &DAG) {
-  EVT SrcVT = LHS.getValueType();
-  assert(VT.getSizeInBits() == SrcVT.getSizeInBits() &&
+  assert(VT.getSizeInBits() == LHS.getValueType().getSizeInBits() &&
          "function only supposed to emit natural comparisons");
 
   switch (CC) {



More information about the llvm-commits mailing list