[llvm] 3a18fe3 - [Utils] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 11:24:39 PDT 2025


Author: Kazu Hirata
Date: 2025-07-31T11:24:33-07:00
New Revision: 3a18fe33f0763cd9276c99c276448412100f6270

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

LOG: [Utils] Fix a warning

This patch fixes:

  llvm/lib/Transforms/Utils/LoopUtils.cpp:818:28: error: unused
  function 'operator<<' [-Werror,-Wunused-function]

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/LoopUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 9043baac7be8e..6327b92922c12 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -815,11 +815,14 @@ struct DbgLoop {
   const Loop *L;
   explicit DbgLoop(const Loop *L) : L(L) {}
 };
+
+#ifndef NDEBUG
 static inline raw_ostream &operator<<(raw_ostream &OS, DbgLoop D) {
   OS << "function ";
   D.L->getHeader()->getParent()->printAsOperand(OS, /*PrintType=*/false);
   return OS << " " << *D.L;
 }
+#endif // NDEBUG
 
 static std::optional<unsigned> estimateLoopTripCount(Loop *L) {
   // Currently we take the estimate exit count only from the loop latch,


        


More information about the llvm-commits mailing list