Skip to content

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Jul 25, 2025

DEBUGLOG_WITH_STREAM_AND_TYPE is an internal implementation detail of LDBG in DebugLog.h. When NDEBUG is defined, DEBUGLOG_WITH_STREAM_AND_TYPE is not defined at all.

Signed-off-by: Benoit Jacob <[email protected]>
@llvmbot llvmbot added the mlir label Jul 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 25, 2025

@llvm/pr-subscribers-mlir

Author: Benoit Jacob (bjacob)

Changes

DEBUGLOG_WITH_STREAM_AND_TYPE is an internal implementation detail of LDBG in DebugLog.h. When NDEBUG is defined, DEBUGLOG_WITH_STREAM_AND_TYPE is not defined at all.


Full diff: https://github.com/llvm/llvm-project/pull/150698.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp (+4)
diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
index 452f23516edb9..96ce980e78471 100644
--- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
@@ -24,8 +24,12 @@
 #define DEBUG_TYPE_FULL "transform-dialect-full"
 #define DEBUG_PRINT_AFTER_ALL "transform-dialect-print-top-level-after-all"
 #define DBGS() (llvm::dbgs() << "[" DEBUG_TYPE "] ")
+#ifndef NDEBUG
 #define FULL_LDBG(X)                                                           \
   DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), DEBUG_TYPE_FULL)
+#else
+#define FULL_LDBG(X)
+#endif
 
 using namespace mlir;
 

@joker-eph joker-eph merged commit 04a44fe into llvm:main Jul 25, 2025
11 checks passed
@bjacob
Copy link
Contributor Author

bjacob commented Jul 25, 2025

@joker-eph , there is a problem -

/home/benjacob/megabump/work/iree/third_party/llvm-project/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp:494:15: error: expected expression
  FULL_LDBG() << "--recordOpHandleInvalidationOne";

Because when FULL_LDBG() expands to empty.... the << binary operator has no LHS at all. How should we address that?

FYI @joker-eph @jpienaar @kuhar

@joker-eph
Copy link
Collaborator

Fixed in 9e09c4d

@jpienaar
Copy link
Member

Thanks! Yes full one there is really trying to do log levels, which is interesting and I was thinking about exposing levels in some way, but had deferred.

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
…s defined (llvm#150698)

DEBUGLOG_WITH_STREAM_AND_TYPE is an internal implementation detail of
LDBG in DebugLog.h. When NDEBUG is defined,
DEBUGLOG_WITH_STREAM_AND_TYPE is not defined at all.

Signed-off-by: Benoit Jacob <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants