Skip to content

Commit

Permalink
[SPIRV] Silence unused variable warnings (#95492)
Browse files Browse the repository at this point in the history
This change marks a few variable declarations as [[maybe_unused]] to
silence unused variable warnings.
  • Loading branch information
llvm-beanz committed Jun 14, 2024
1 parent dfde077 commit e83adfe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@dwblaikie

dwblaikie Jun 17, 2024

Collaborator

Could simplify this a bit further by putting the for loop inside the assert?

assert(llvm::all_of(this->Exits, [&](auto *BB) { 
  return this->Blocks.count(BB) != 0;
});
for ([[maybe_unused]] auto *BB : this->Exits)
assert(this->Blocks.count(BB) != 0);
assert(this->Blocks.count(this->Entry) != 0);
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e83adfe

Please sign in to comment.