[GlobalISel] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off builds after D114198
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 6b50fa4..262dc16 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -3630,6 +3630,7 @@
   return MIRBuilder.buildPtrAdd(PtrTy, VecPtr, Mul).getReg(0);
 }
 
+#ifndef NDEBUG
 /// Check that all vector operands have same number of elements. Other operands
 /// should be listed in NonVecOp.
 static bool hasSameNumEltsOnAllVectorOperands(
@@ -3665,6 +3666,7 @@
 
   return true;
 }
+#endif
 
 /// Fill \p DstOps with DstOps that have same number of elements combined as
 /// the Ty. These DstOps have either scalar type when \p NumElts = 1 or are