[llvm] c03b6e8 - [SPIRV] Mark maybe unused extractSubvector variable (#116117)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 16:44:22 PST 2024


Author: Greg Roth
Date: 2024-11-13T17:44:18-07:00
New Revision: c03b6e89434c11c936dc2fa8b01f1deb95b1923a

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

LOG: [SPIRV] Mark maybe unused extractSubvector variable (#116117)

Change #115178 introduced a variable that is only used in an assert,
which could result in an unused variable warning in builds without
asserts enabled. This just addes the maybe_unused attribute to silence
the warning.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index 8a8835e0269200..b5dce14cd0bc1e 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -2941,7 +2941,8 @@ void SPIRVInstructionSelector::extractSubvector(
     Register &ResVReg, const SPIRVType *ResType, Register &ReadReg,
     MachineInstr &InsertionPoint) const {
   SPIRVType *InputType = GR.getResultType(ReadReg);
-  uint64_t InputSize = GR.getScalarOrVectorComponentCount(InputType);
+  [[maybe_unused]] uint64_t InputSize =
+      GR.getScalarOrVectorComponentCount(InputType);
   uint64_t ResultSize = GR.getScalarOrVectorComponentCount(ResType);
   assert(InputSize > 1 && "The input must be a vector.");
   assert(ResultSize > 1 && "The result must be a vector.");


        


More information about the llvm-commits mailing list