[test-suite] r277684 - [test-suite] Bitcode tests: Update cmake to build driver and halide runtime only once.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 17:49:52 PDT 2016


Author: asbirlea
Date: Wed Aug  3 19:49:52 2016
New Revision: 277684

URL: http://llvm.org/viewvc/llvm-project?rev=277684&view=rev
Log:
[test-suite] Bitcode tests: Update cmake to build driver and halide runtime only once.

Summary:
The simd_ops bitcode tests used to build the common driver and the halide runtime for each test.
Update cmake so they are build just once.
Note that in the future the halide runtime could be taken up one directory level and used in common for
multiple tests and benchmark. However building just the one .bc file into a static library failed on OSX.

Reviewers: mehdi_amini, MatzeB

Subscribers: llvm-commits

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

Modified:
    test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt
    test-suite/trunk/cmake/modules/SingleMultiSource.cmake

Modified: test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt?rev=277684&r1=277683&r2=277684&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt (original)
+++ test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt Wed Aug  3 19:49:52 2016
@@ -6,14 +6,19 @@ SET_SOURCE_FILES_PROPERTIES(${scalar_sou
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/simd_op_check_runtime.bc PROPERTIES LANGUAGE CXX)
 
 list(APPEND LDFLAGS -lpthread -ldl)
+add_library(simd_ops STATIC simd_ops.cpp ${ARCH}_halide_runtime.bc)
+target_link_libraries(simd_ops)
+test_suite_add_build_dependencies(simd_ops)
+set_target_properties(simd_ops PROPERTIES LINKER_LANGUAGE CXX)
 
 foreach(sourcebc ${uosources})
   string(REGEX REPLACE ".[cp]+$" "" pathbc ${sourcebc})
   string(REGEX REPLACE ".*/" "" namebc ${pathbc})
   string(REPLACE "." "" namebc ${namebc})
-  set(Source ${CMAKE_CURRENT_SOURCE_DIR}/simd_ops.cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_halide_runtime.bc ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_tests/${namebc}.bc ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_scalar_tests/scalar_${namebc}.bc)
+  set(Source ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_halide_runtime.bc ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_tests/${namebc}.bc ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_scalar_tests/scalar_${namebc}.bc)
   set(PROG simd_ops_${namebc})
   llvm_multisource()
+  target_link_libraries(${PROG} simd_ops)
 endforeach()
 
 

Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=277684&r1=277683&r2=277684&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Wed Aug  3 19:49:52 2016
@@ -118,6 +118,13 @@ function(llvm_test_traditional testfile
   llvm_add_test(${testfile} ${executable})
 endfunction()
 
+macro (test_suite_add_build_dependencies executable)
+  if (NOT TEST_SUITE_USE_PERF)
+    add_dependencies(${executable} timeit-target)
+  endif()
+  add_dependencies(${executable} timeit-host fpcmp-host)
+endmacro()
+
 macro(test_suite_add_executable name mainsource)
   list(FIND PROGRAMS_TO_SKIP ${name} name_idx)
   # Should we skip this?
@@ -145,10 +152,7 @@ macro(test_suite_add_executable name mai
     else()
       llvm_add_test(${executable_path}.test ${executable_path})
     endif()
-    if (NOT TEST_SUITE_USE_PERF)
-      add_dependencies(${executable} timeit-target)
-    endif()
-    add_dependencies(${executable} timeit-host fpcmp-host)
+    test_suite_add_build_dependencies(${executable})
   endif()
 endmacro()
 




More information about the llvm-commits mailing list