[llvm] a4b2975 - [SPIRV] Fix unused-variable warnings (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 18:13:52 PDT 2025


Author: Jie Fu
Date: 2025-10-04T09:13:37+08:00
New Revision: a4b297532d3b3555b70c8b047e7d0ef3457f6ac8

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

LOG: [SPIRV] Fix unused-variable warnings (NFC)

/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:198:12:
 error: unused variable 'dstBitWidth' [-Werror,-Wunused-variable]
      auto dstBitWidth =
           ^
/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:200:12:
 error: unused variable 'srcBitWidth' [-Werror,-Wunused-variable]
      auto srcBitWidth =
           ^
2 errors generated.

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp b/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp
index ebd957c42762c..e8c849ed00c74 100644
--- a/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp
@@ -195,9 +195,9 @@ class SPIRVLegalizePointerCast : public FunctionPass {
     if (DstType->getElementType() != SrcType->getElementType()) {
       // Support bitcast between vectors of 
diff erent sizes only if
       // the total bitwidth is the same.
-      auto dstBitWidth =
+      [[maybe_unused]] auto dstBitWidth =
           DstType->getElementType()->getScalarSizeInBits() * dstNumElements;
-      auto srcBitWidth =
+      [[maybe_unused]] auto srcBitWidth =
           SrcType->getElementType()->getScalarSizeInBits() * srcNumElements;
       assert(dstBitWidth == srcBitWidth &&
              "Unsupported bitcast between vectors of 
diff erent sizes.");


        


More information about the llvm-commits mailing list