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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 10:26:22 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Chenguang Wang (wecing)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/143175.diff


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+1-2) 


``````````diff
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) {

``````````

</details>


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


More information about the llvm-commits mailing list