[compiler-rt] r254618 - [sanitizer] Cache results of darwin_test_archs

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 09:02:07 PST 2015


Author: kuba.brecka
Date: Thu Dec  3 11:02:07 2015
New Revision: 254618

URL: http://llvm.org/viewvc/llvm-project?rev=254618&view=rev
Log:
[sanitizer] Cache results of darwin_test_archs

For OS X builds of compiler-rt, we run `darwin_test_archs` to determine which architectures can the toolchain target. This detection takes quite a long time, and the result is always the same (as long as you don't upgrade your OS, system headers or toolchain). Let's cache the result.

Differential Revision: http://reviews.llvm.org/D15179


Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake?rev=254618&r1=254617&r2=254618&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Thu Dec  3 11:02:07 2015
@@ -46,6 +46,11 @@ endfunction()
 # This function takes an OS and a list of architectures and identifies the
 # subset of the architectures list that the installed toolchain can target.
 function(darwin_test_archs os valid_archs)
+  if(${valid_archs})
+    message(STATUS "Using cached valid architectures for ${os}.")
+    return()
+  endif()
+
   set(archs ${ARGN})
   message(STATUS "Finding valid architectures for ${os}...")
   set(SIMPLE_CPP ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.cpp)
@@ -75,7 +80,8 @@ function(darwin_test_archs os valid_arch
       list(APPEND working_archs ${arch})
     endif()
   endforeach()
-  set(${valid_archs} ${working_archs} PARENT_SCOPE)
+  set(${valid_archs} ${working_archs}
+    CACHE STRING "List of valid architectures for platform ${os}.")
 endfunction()
 
 # This function checks the host cpusubtype to see if it is post-haswell. Haswell




More information about the llvm-commits mailing list