[llvm] 71a1971 - [IR] Remove unused and mark debug-only verifier templates (NFC) (#202975)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 08:02:15 PDT 2026


Author: Aditya Medhane
Date: 2026-06-10T15:02:08Z
New Revision: 71a19716198adcd11c67d6a433e37b2d87afe4f1

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

LOG: [IR] Remove unused and mark debug-only verifier templates (NFC) (#202975)

Two verifier templates trip `-Wunused-template`.

In `Verifier.cpp`, `isValidMetadataArray` is a leftover declaration with
no definition and no callers, so it's removed. In
`SafepointIRVerifier.cpp`, `PrintValueSet` is only used inside
`LLVM_DEBUG`, so it gets compiled out in release builds and never
instantiates; it's marked `[[maybe_unused]]`.

NFC.

Part of #202945.

Added: 
    

Modified: 
    llvm/lib/IR/SafepointIRVerifier.cpp
    llvm/lib/IR/Verifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index b1fb621c41baf..ee4df5b8f03ba 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -267,8 +267,11 @@ static bool containsGCPtrType(Type *Ty) {
 }
 
 // Debugging aid -- prints a [Begin, End) range of values.
-template<typename IteratorTy>
-static void PrintValueSet(raw_ostream &OS, IteratorTy Begin, IteratorTy End) {
+// Only used inside LLVM_DEBUG below, so it has no instantiations in release
+// builds (NDEBUG); [[maybe_unused]] avoids -Wunused-template in that case.
+template <typename IteratorTy>
+[[maybe_unused]] static void PrintValueSet(raw_ostream &OS, IteratorTy Begin,
+                                           IteratorTy End) {
   OS << "[ ";
   while (Begin != End) {
     OS << **Begin << " ";

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 2525e827872ab..b36a5cbce6813 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -555,7 +555,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
   void visitInlineHistoryMetadata(Instruction &I, MDNode *MD);
   void visitMemCacheHintMetadata(Instruction &I, MDNode *MD);
 
-  template <class Ty> bool isValidMetadataArray(const MDTuple &N);
 #define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void visit##CLASS(const CLASS &N);
 #include "llvm/IR/Metadata.def"
   void visitDIType(const DIType &N);


        


More information about the llvm-commits mailing list