[llvm] [SPIRV] Mark maybe unused extractSubvector variable (PR #116117)
Greg Roth via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 15:01:17 PST 2024
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/116117
>From 872d2b45e71814ce9eafe78fcce3160a88baffbb Mon Sep 17 00:00:00 2001
From: Greg Roth <grroth at microsoft.com>
Date: Wed, 13 Nov 2024 15:54:13 -0700
Subject: [PATCH 1/2] [SPIRV] Mark maybe unused extractSubvector variable
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.
---
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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.");
>From b6098148bf334f2cadeb36e74bb5194cf4ff09e9 Mon Sep 17 00:00:00 2001
From: Greg Roth <grroth at microsoft.com>
Date: Wed, 13 Nov 2024 16:01:00 -0700
Subject: [PATCH 2/2] bit by clang-format
---
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index 4e6fce96087c93..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);
- [[maybe_unused]] 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