Skip to content

Conversation

@pow2clk
Copy link

@pow2clk pow2clk commented Nov 13, 2024

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.

Change llvm#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.
@pow2clk
Copy link
Author

pow2clk commented Nov 13, 2024

Hi @s-perron, Really simple followup.

@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2024

@llvm/pr-subscribers-backend-spir-v

Author: Greg Roth (pow2clk)

Changes

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.


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

1 Files Affected:

  • (modified) llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (+1-1)
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index 8a8835e0269200..4e6fce96087c93 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -2941,7 +2941,7 @@ 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.");

@github-actions
Copy link

github-actions bot commented Nov 13, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@pow2clk pow2clk merged commit c03b6e8 into llvm:main Nov 14, 2024
9 checks passed
@pow2clk pow2clk deleted the spriv_warn branch November 14, 2024 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants