Skip to content

Commit e281800

Browse files
authored
Revert: check-builtins target for LLVM_ENABLE_RUNTIMES (#171940)
Revert #171741 and #166837. @petrhosek reported issues with some builders using this feature
1 parent ee22217 commit e281800

File tree

6 files changed

+9
-70
lines changed

6 files changed

+9
-70
lines changed

compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,6 @@ macro(darwin_add_builtin_library name suffix)
284284
${ARGN})
285285
set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
286286
add_library(${libname} STATIC ${LIB_SOURCES})
287-
288-
# Write out the sources that were used to compile the builtins so that tests can be run in
289-
# an independent compiler-rt build (see: compiler-rt/test/builtins/CMakeLists.txt)
290-
file(WRITE "${CMAKE_BINARY_DIR}/${libname}.sources.txt" "${LIB_SOURCES}")
291-
292287
if(DARWIN_${LIB_OS}_SYSROOT)
293288
set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
294289
endif()

compiler-rt/cmake/builtin-config-ix.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,6 @@ else()
280280
# Architectures supported by compiler-rt libraries.
281281
filter_available_targets(BUILTIN_SUPPORTED_ARCH
282282
${ALL_BUILTIN_SUPPORTED_ARCH})
283-
284-
# COMPILER_RT_HAS_${arch}_* defines that are shared between lib/builtins/ and test/builtins/
285-
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
286-
# NOTE: The corresponding check for if(APPLE) is in CompilerRTDarwinUtils.cmake
287-
check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
288-
int main(void) { return 0; }"
289-
COMPILER_RT_HAS_${arch}_FLOAT16)
290-
endforeach()
291283
endif()
292284

293285
if(OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER AND NOT

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@ else ()
990990
endif()
991991
endif()
992992
endif()
993+
check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
994+
int main(void) { return 0; }"
995+
COMPILER_RT_HAS_${arch}_FLOAT16)
993996
append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch})
994997
check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }
995998
int main(void) { return 0; }"
@@ -1025,9 +1028,6 @@ else ()
10251028
C_STANDARD 11
10261029
CXX_STANDARD 17
10271030
PARENT_TARGET builtins)
1028-
# Write out the sources that were used to compile the builtins so that tests can be run in
1029-
# an independent compiler-rt build (see: compiler-rt/test/builtins/CMakeLists.txt)
1030-
file(WRITE "${CMAKE_BINARY_DIR}/clang_rt.builtins-${arch}.sources.txt" "${${arch}_SOURCES}")
10311031
cmake_pop_check_state()
10321032
endif ()
10331033
endforeach ()

compiler-rt/test/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ endfunction()
7373
# Run sanitizer tests only if we're sure that clang would produce
7474
# working binaries.
7575
if(COMPILER_RT_CAN_EXECUTE_TESTS)
76-
# COMPILER_RT_TEST_BUILTINS_DIR allows running tests against builtins built
77-
# in an independent build. This option is only indended to be used by
78-
# LLVM_ENABLE_RUNTIMES-based builds.
79-
if(COMPILER_RT_BUILD_BUILTINS OR COMPILER_RT_TEST_BUILTINS_DIR)
76+
if(COMPILER_RT_BUILD_BUILTINS)
8077
add_subdirectory(builtins)
8178
endif()
8279
if(COMPILER_RT_BUILD_SANITIZERS)

compiler-rt/test/builtins/CMakeLists.txt

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
set(BUILTINS_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22

3-
# If COMPILER_RT_TEST_BUILTINS_DIR is set, the builtins
4-
# were already built and we are just going to test them.
5-
# NOTE: This is currently an LLVM-internal option which should
6-
# only be used by the LLVM_ENABLE_RUNTIMES build configured
7-
# in llvm/runtimes/CMakeLists.txt
8-
if(COMPILER_RT_TEST_BUILTINS_DIR)
9-
set(BUILTINS_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
10-
else()
11-
set(BUILTINS_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} builtins)
12-
endif()
13-
3+
set(BUILTINS_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} builtins)
144
set(BUILTINS_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/TestCases)
155

166
# Test cases.
@@ -94,19 +84,10 @@ foreach(arch ${BUILTIN_TEST_ARCH})
9484
else()
9585
set(BUILTIN_LIB_TARGET_NAME "clang_rt.builtins-${arch}")
9686
endif()
97-
# Normally, we can just inspect the target directly to get the sources, but if
98-
# we are testing an externally-built builtins library, we expect
99-
# COMPILER_RT_TEST_BUILTINS_DIR to be set and contain a file named
100-
# ${BUILTIN_LIB_TARGET_NAME}.sources.txt from the builtins build. This file
101-
# is created by compiler-rt/lib/builtins/CMakeLists.txt
102-
if(NOT COMPILER_RT_TEST_BUILTINS_DIR)
103-
if (NOT TARGET "${BUILTIN_LIB_TARGET_NAME}")
104-
message(FATAL_ERROR "Target ${BUILTIN_LIB_TARGET_NAME} does not exist")
105-
endif()
106-
get_target_property(BUILTIN_LIB_SOURCES "${BUILTIN_LIB_TARGET_NAME}" SOURCES)
107-
else()
108-
file(READ "${COMPILER_RT_TEST_BUILTINS_DIR}/${BUILTIN_LIB_TARGET_NAME}.sources.txt" BUILTIN_LIB_SOURCES)
87+
if (NOT TARGET "${BUILTIN_LIB_TARGET_NAME}")
88+
message(FATAL_ERROR "Target ${BUILTIN_LIB_TARGET_NAME} does not exist")
10989
endif()
90+
get_target_property(BUILTIN_LIB_SOURCES "${BUILTIN_LIB_TARGET_NAME}" SOURCES)
11091
list(LENGTH BUILTIN_LIB_SOURCES BUILTIN_LIB_SOURCES_LENGTH)
11192
if (BUILTIN_LIB_SOURCES_LENGTH EQUAL 0)
11293
message(FATAL_ERROR "Failed to find source files for ${arch} builtin library")

llvm/runtimes/CMakeLists.txt

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,7 @@ function(runtime_default_target)
262262

263263
if(LLVM_INCLUDE_TESTS)
264264
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/runtimes-bins/lit.tests")
265-
list(APPEND test_targets runtimes-test-depends check-runtimes check-builtins)
266-
267-
# The default runtimes target can run tests the default builtins target
268-
list(APPEND ARG_CMAKE_ARGS "-DCOMPILER_RT_TEST_BUILTINS_DIR=${LLVM_BINARY_DIR}/runtimes/builtins-bins/")
265+
list(APPEND test_targets runtimes-test-depends check-runtimes)
269266
endif()
270267

271268
set_enable_per_target_runtime_dir()
@@ -372,15 +369,6 @@ function(runtime_register_target name)
372369
list(APPEND ${name}_test_targets ${target}-${name})
373370
list(APPEND test_targets ${target}-${name})
374371
endforeach()
375-
376-
# If a builtins-${name} target exists, we'll test those builtins
377-
# with this runtimes build
378-
if(TARGET builtins-${name})
379-
list(APPEND ARG_CMAKE_ARGS "-DCOMPILER_RT_TEST_BUILTINS_DIR=${LLVM_BINARY_DIR}/runtimes/builtins-${name}-bins/")
380-
set(check-builtins-${name} check-builtins)
381-
list(APPEND ${name}_test_targets check-builtins-${name})
382-
list(APPEND test_targets check-builtins-${name})
383-
endif()
384372
set(test_targets "${test_targets}" PARENT_SCOPE)
385373
endif()
386374

@@ -446,9 +434,6 @@ function(runtime_register_target name)
446434
if(LLVM_INCLUDE_TESTS)
447435
add_dependencies(check-runtimes check-runtimes-${name})
448436
add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
449-
if(TARGET builtins-${name})
450-
add_dependencies(check-builtins check-builtins-${name})
451-
endif()
452437
endif()
453438
foreach(runtime_name ${runtime_names})
454439
if(NOT TARGET ${runtime_name})
@@ -624,17 +609,6 @@ if(build_runtimes)
624609
PROPERTIES FOLDER "Runtimes"
625610
)
626611
set(test_targets "")
627-
628-
# NOTE: Currently, the builtins tests are run with the runtimes build,
629-
# and the default runtimes target installs a check-builtins target
630-
# which forwards to the default builtins build. If the default runtimes
631-
# target is not used, we create a custom target which will depend on
632-
# each check-builtins-${name}.
633-
add_custom_target(check-builtins)
634-
set_target_properties(
635-
check-builtins
636-
PROPERTIES FOLDER "Compiler-RT"
637-
)
638612
endif()
639613
if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
640614
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})

0 commit comments

Comments
 (0)