[PATCH] D78884: [CMake] -gen-dag-isel: add -omit-comments if neither Debug nor RelWithDebInfo

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 26 14:20:37 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: nhaehnle, rnk.
Herald added subscribers: llvm-commits, kristof.beyls, mgorny.
Herald added a project: LLVM.

Omitting comments can make the output much smaller. Size/time impact on
my machine:

- lib/Target/AArch64/AArch64GenDAGISel.inc, 10MiB (8.89s) -> 5MiB (3.20s)
- lib/Target/X86/X86GenDAGISel.inc, 20MiB (6.48s) -> 8.5MiB (4.18s)

In total, this change decreases lib/Target/*/*GenDAGISel.inc from
71.4MiB to 30.1MiB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78884

Files:
  llvm/cmake/modules/TableGen.cmake


Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -53,6 +53,15 @@
       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: D78884.260181.patch
Type: text/x-patch
Size: 855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200426/e75ca61a/attachment.bin>


More information about the llvm-commits mailing list