[llvm] 10470da - [SPIRV] Fix -Wunused-variable (#219207)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 06:21:33 PDT 2026
Author: Aiden Grossman
Date: 2026-08-27T06:21:27-07:00
New Revision: 10470da54729f80ff255bd7c59b72107151dcfd7
URL: https://github.com/llvm/llvm-project/commit/10470da54729f80ff255bd7c59b72107151dcfd7
DIFF: https://github.com/llvm/llvm-project/commit/10470da54729f80ff255bd7c59b72107151dcfd7.diff
LOG: [SPIRV] Fix -Wunused-variable (#219207)
These variables are only used in assertions but are used multiple
times/do not make sense to inline, so mark them [[maybe_unused]].
Added:
Modified:
llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 433edbfb12a9f..29d21fb9447ca 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -635,7 +635,7 @@ Register SPIRVGlobalRegistry::getOrCreateConstVector(const APInt &Val,
"Expected vector type for constant vector creation");
const FixedVectorType *LLVMVecTy = cast<FixedVectorType>(LLVMTy);
Type *LLVMBaseTy = LLVMVecTy->getElementType();
- const auto &ST = I.getMF()->getSubtarget<SPIRVSubtarget>();
+ [[maybe_unused]] const auto &ST = I.getMF()->getSubtarget<SPIRVSubtarget>();
assert((LLVMBaseTy->isIntegerTy() ||
(LLVMBaseTy->isPointerTy() &&
ST.canUseExtension(
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index e64c5ad38ba2a..2ec4ede8dd8f5 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -6745,7 +6745,7 @@ bool SPIRVInstructionSelector::extractSubvector(
[[maybe_unused]] uint64_t InputSize =
GR.getScalarOrVectorComponentCount(InputType);
uint64_t ResultSize = GR.getScalarOrVectorComponentCount(ResType);
- bool IsLongVectorEXT =
+ [[maybe_unused]] bool IsLongVectorEXT =
STI.canUseExtension(SPIRV::Extension::SPV_EXT_long_vector);
assert((InputSize > 1 || IsLongVectorEXT) && "The input must be a vector.");
assert((ResultSize > 1 || IsLongVectorEXT) && "The result must be a vector.");
More information about the llvm-commits
mailing list