[compiler-rt] Add NewPM testing to CFI tests
authorTeresa Johnson <tejohnson@google.com>
Thu, 19 Jul 2018 15:32:48 +0000 (15:32 +0000)
committerTeresa Johnson <tejohnson@google.com>
Thu, 19 Jul 2018 15:32:48 +0000 (15:32 +0000)
Summary:
Executes both LTO and ThinLTO CFI tests an additional time using the new
pass manager. I only bothered to add with gold and not lld as testing
with one linker should be sufficient. I didn't add for APPLE or WIN32
since I don't have a way to test those.

Depends on D49429.

Reviewers: pcc

Subscribers: dberris, mgorny, mehdi_amini, delcypher, dexonsmith, #sanitizers, llvm-commits

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

llvm-svn: 337465

compiler-rt/test/cfi/CMakeLists.txt
compiler-rt/test/cfi/lit.site.cfg.in
compiler-rt/test/lit.common.cfg
compiler-rt/test/lit.common.configured.in

index c7fadde..4dbbf17 100644 (file)
@@ -1,6 +1,6 @@
 set(CFI_TESTSUITES)
 
-macro (add_cfi_test_suites lld thinlto)
+macro (add_cfi_test_suites lld thinlto newpm)
   set(suffix)
   if (${lld})
     set(suffix ${suffix}-lld)
@@ -8,10 +8,14 @@ macro (add_cfi_test_suites lld thinlto)
   if (${thinlto})
     set(suffix ${suffix}-thinlto)
   endif()
+  if (${newpm})
+    set(suffix ${suffix}-newpm)
+  endif()
   set(suffix ${suffix}-${CFI_TEST_TARGET_ARCH})
 
   set(CFI_TEST_USE_LLD ${lld})
   set(CFI_TEST_USE_THINLTO ${thinlto})
+  set(CFI_TEST_USE_NEWPM ${newpm})
 
   set(CFI_LIT_TEST_MODE Standalone)
   set(CFI_TEST_CONFIG_SUFFIX -standalone${suffix})
@@ -40,16 +44,18 @@ foreach(arch ${CFI_TEST_ARCH})
   get_test_cc_for_arch(${arch} CFI_TEST_TARGET_CC CFI_TEST_TARGET_CFLAGS)
   if (APPLE)
     # FIXME: enable ThinLTO tests after fixing http://llvm.org/pr32741
-    add_cfi_test_suites(False False)
+    add_cfi_test_suites(False False False)
   elseif(WIN32)
-    add_cfi_test_suites(True False)
-    add_cfi_test_suites(True True)
+    add_cfi_test_suites(True False False)
+    add_cfi_test_suites(True True False)
   else()
-    add_cfi_test_suites(False False)
-    add_cfi_test_suites(False True)
+    add_cfi_test_suites(False False False)
+    add_cfi_test_suites(False True False)
+    add_cfi_test_suites(False False True)
+    add_cfi_test_suites(False True True)
     if (COMPILER_RT_HAS_LLD AND NOT arch STREQUAL "i386")
-      add_cfi_test_suites(True False)
-      add_cfi_test_suites(True True)
+           add_cfi_test_suites(True False False)
+           add_cfi_test_suites(True True False)
     endif()
   endif()
 endforeach()
index eb9b441..a735e88 100644 (file)
@@ -7,6 +7,7 @@ config.target_cflags = "@CFI_TEST_TARGET_CFLAGS@"
 config.use_lld = @CFI_TEST_USE_LLD@
 config.use_lto = True # CFI *requires* LTO.
 config.use_thinlto = @CFI_TEST_USE_THINLTO@
+config.use_newpm = @CFI_TEST_USE_NEWPM@
 
 lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
index 4137e1c..e860be4 100644 (file)
@@ -317,6 +317,9 @@ if config.lto_supported:
   else:
     config.lto_flags += ["-flto"]
 
+if config.use_newpm:
+  config.lto_flags += ["-fexperimental-new-pass-manager"]
+
 # Ask llvm-config about assertion mode.
 try:
   llvm_config_cmd = subprocess.Popen(
index 17f470d..63d55bf 100644 (file)
@@ -34,6 +34,7 @@ set_default("can_symbolize", @CAN_SYMBOLIZE@)
 set_default("use_lld", False)
 set_default("use_thinlto", False)
 set_default("use_lto", config.use_thinlto)
+set_default("use_newpm", False)
 set_default("android", @ANDROID_PYBOOL@)
 config.available_features.add('target-is-%s' % config.target_arch)