[PATCH] D114122: [CMake] Use NDEBUG macro to control adding comments in GenDAGISel.inc

Lei Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 14:03:53 PST 2021


lei created this revision.
lei added reviewers: nemanjai, stefanp, MaskRay.
Herald added a subscriber: mgorny.
lei requested review of this revision.
Herald added a project: LLVM.

This patch reverts the patch from https://reviews.llvm.org/D78884 and
adds logic to disable comments based on NDEBUG.

Original patch removes the indices into the MatcherTable. Controling this via
NDEBUG seems reasonable since the debug messages from the SDAG that refer to
these are also guarded by that macro (since they are LLVM_DEBUG messages).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114122

Files:
  llvm/cmake/modules/TableGen.cmake
  llvm/utils/TableGen/DAGISelMatcherEmitter.cpp


Index: llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
===================================================================
--- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -37,7 +37,12 @@
 // To reduce generated source code size.
 static cl::opt<bool> OmitComments("omit-comments",
                                   cl::desc("Do not generate comments"),
-                                  cl::init(false), cl::cat(DAGISelCat));
+#ifdef NDEBUG
+                                  cl::init(true),
+#else
+                                  cl::init(false),
+#endif
+                                  cl::cat(DAGISelCat));
 
 static cl::opt<bool> InstrumentCoverage(
     "instrument-coverage",
Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -53,15 +53,6 @@
       list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all")
     endif()
   endif()
-  # Comments are only useful for Debug builds. Omit them if the backend
-  # supports it.
-  if (NOT (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR
-           uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO"))
-    list(FIND ARGN "-gen-dag-isel" idx)
-    if (NOT idx EQUAL -1)
-      list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments")
-    endif()
-  endif()
 
   # MSVC can't support long string literals ("long" > 65534 bytes)[1], so if there's
   # a possibility of generated tables being consumed by MSVC, generate arrays of


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114122.388034.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211117/67db47de/attachment.bin>


More information about the llvm-commits mailing list