[llvm] 022039e - [SPIRV] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 06:58:02 PDT 2025


Author: Kazu Hirata
Date: 2025-08-01T06:57:56-07:00
New Revision: 022039e4978991bd15263a78122166c0d3def8bb

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

LOG: [SPIRV] Fix a warning

This patch fixes:

  llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp:642:16: error: unused
  variable 'StructSize' [-Werror,-Wunused-variable]

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
index c4c7e8516401c..947b574dd5dda 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
@@ -641,6 +641,7 @@ bool SPIRVEmitIntrinsics::walkLogicalAccessChain(
     } else if (StructType *ST = dyn_cast<StructType>(CurType)) {
       uint32_t StructSize = DL.getTypeSizeInBits(ST) / 8;
       assert(Offset < StructSize);
+      (void)StructSize;
       const auto &STL = DL.getStructLayout(ST);
       unsigned Element = STL->getElementContainingOffset(Offset);
       Offset -= STL->getElementOffset(Element);


        


More information about the llvm-commits mailing list