Skip to content

[SPIRV] Mark maybe unused extractSubvector variable #116117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Conversation

pow2clk
Copy link
Contributor

@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
Contributor 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.");

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