Revert "[LoongArch] Eliminate the redundant sign extension of division (#107971)"
[llvm-project.git] / .ci / monolithic-linux.sh
blobb78dc59432b65c9dcdf5130fe6aea85fb2d03148
1 #!/usr/bin/env bash
2 #===----------------------------------------------------------------------===##
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===----------------------------------------------------------------------===##
11 # This script performs a monolithic build of the monorepo and runs the tests of
12 # most projects on Linux. This should be replaced by per-project scripts that
13 # run only the relevant tests.
16 set -ex
17 set -o pipefail
19 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
20 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
21 INSTALL_DIR="${BUILD_DIR}/install"
22 rm -rf "${BUILD_DIR}"
24 ccache --zero-stats
26 if [[ -n "${CLEAR_CACHE:-}" ]]; then
27 echo "clearing cache"
28 ccache --clear
31 function show-stats {
32 mkdir -p artifacts
33 ccache --print-stats > artifacts/ccache_stats.txt
35 trap show-stats EXIT
37 projects="${1}"
38 targets="${2}"
40 echo "--- cmake"
41 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
42 pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
43 cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
44 -D LLVM_ENABLE_PROJECTS="${projects}" \
45 -G Ninja \
46 -D CMAKE_BUILD_TYPE=Release \
47 -D LLVM_ENABLE_ASSERTIONS=ON \
48 -D LLVM_BUILD_EXAMPLES=ON \
49 -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
50 -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
51 -D LLVM_ENABLE_LLD=ON \
52 -D CMAKE_CXX_FLAGS=-gmlt \
53 -D LLVM_CCACHE_BUILD=ON \
54 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
55 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
57 echo "--- ninja"
58 # Targets are not escaped as they are passed as separate arguments.
59 ninja -C "${BUILD_DIR}" -k 0 ${targets}
61 runtimes="${3}"
62 runtime_targets="${4}"
64 # Compiling runtimes with just-built Clang and running their tests
65 # as an additional testing for Clang.
66 if [[ "${runtimes}" != "" ]]; then
67 if [[ "${runtime_targets}" == "" ]]; then
68 echo "Runtimes to build are specified, but targets are not."
69 exit 1
72 echo "--- ninja install-clang"
74 ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
76 RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
77 INSTALL_DIR="${BUILD_DIR}/install"
78 mkdir -p ${RUNTIMES_BUILD_DIR}
80 echo "--- cmake runtimes C++03"
82 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
83 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
84 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
85 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
86 -D LIBCXX_CXX_ABI=libcxxabi \
87 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
88 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
89 -D LIBCXX_TEST_PARAMS="std=c++03" \
90 -D LIBCXXABI_TEST_PARAMS="std=c++03"
92 echo "--- ninja runtimes C++03"
94 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
96 echo "--- cmake runtimes C++26"
98 rm -rf "${RUNTIMES_BUILD_DIR}"
99 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
100 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
101 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
102 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
103 -D LIBCXX_CXX_ABI=libcxxabi \
104 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
105 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
106 -D LIBCXX_TEST_PARAMS="std=c++26" \
107 -D LIBCXXABI_TEST_PARAMS="std=c++26"
109 echo "--- ninja runtimes C++26"
111 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
113 echo "--- cmake runtimes clang modules"
115 rm -rf "${RUNTIMES_BUILD_DIR}"
116 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
117 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
118 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
119 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
120 -D LIBCXX_CXX_ABI=libcxxabi \
121 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
122 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
123 -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
124 -D LIBCXXABI_TEST_PARAMS="enable_modules=clang"
126 echo "--- ninja runtimes clang modules"
128 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}