[llvm] e83adfe - [SPIRV] Silence unused variable warnings (#95492)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 01:44:27 PDT 2024


Author: Chris B
Date: 2024-06-14T10:44:24+02:00
New Revision: e83adfe59632d2e2f8ff26db33087ba7fb754485

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

LOG: [SPIRV] Silence unused variable warnings (#95492)

This change marks a few variable declarations as [[maybe_unused]] to
silence unused variable warnings.

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
    llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp b/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
index 7f5f7d0b1e4dc..25e285e35f933 100644
--- a/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
@@ -138,7 +138,7 @@ ConvergenceRegion::ConvergenceRegion(
     SmallPtrSet<BasicBlock *, 8> &&Blocks, SmallPtrSet<BasicBlock *, 2> &&Exits)
     : DT(DT), LI(LI), ConvergenceToken(ConvergenceToken), Entry(Entry),
       Exits(std::move(Exits)), Blocks(std::move(Blocks)) {
-  for (auto *BB : this->Exits)
+  for ([[maybe_unused]] auto *BB : this->Exits)
     assert(this->Blocks.count(BB) != 0);
   assert(this->Blocks.count(this->Entry) != 0);
 }

diff  --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 2a515359bdd4f..c14e5098be711 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -2418,7 +2418,7 @@ Type *parseBuiltinCallArgumentBaseType(const StringRef DemangledCall,
   if (hasBuiltinTypePrefix(TypeStr)) {
     // OpenCL builtin types in demangled call strings have the following format:
     // e.g. ocl_image2d_ro
-    bool IsOCLBuiltinType = TypeStr.consume_front("ocl_");
+    [[maybe_unused]] bool IsOCLBuiltinType = TypeStr.consume_front("ocl_");
     assert(IsOCLBuiltinType && "Invalid OpenCL builtin prefix");
 
     // Check if this is pointer to a builtin type and not just pointer


        


More information about the llvm-commits mailing list