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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 14:03:16 PDT 2020


Author: Fangrui Song
Date: 2020-05-15T14:03:05-07:00
New Revision: a63eedd049bfde97f1d73caa61d27df600501c54

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

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

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.

As rnk suggested, we can consider an option next to LLVM_OPTIMIZED_TABLEGEN
once we have more needs like this.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D78884

Added: 
    

Modified: 
    llvm/cmake/modules/TableGen.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 65e31d0624f0..73c1e96d3d9a 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -53,6 +53,15 @@ function(tablegen project ofn)
       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


        


More information about the llvm-commits mailing list