Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / utils / ci / run-buildbot
blobf47ffb5cbd38dcd0f91b248bcf4c3a4c71a17337
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 #===----------------------------------------------------------------------===##
10 set -ex
11 set -o pipefail
12 unset LANG
13 unset LC_ALL
14 unset LC_COLLATE
16 PROGNAME="$(basename "${0}")"
18 function usage() {
19 cat <<EOF
20 Usage:
21 ${PROGNAME} [options] <BUILDER>
23 [-h|--help] Display this help and exit.
25 --llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try
26 to figure it out based on the current working directory.
28 --build-dir <DIR> The directory to use for building the library. By default,
29 this is '<llvm-root>/build/<builder>'.
30 EOF
33 if [[ $# == 0 ]]; then
34 usage
35 exit 0
38 while [[ $# -gt 0 ]]; do
39 case ${1} in
40 -h|--help)
41 usage
42 exit 0
44 --llvm-root)
45 MONOREPO_ROOT="${2}"
46 shift; shift
48 --build-dir)
49 BUILD_DIR="${2}"
50 shift; shift
53 BUILDER="${1}"
54 shift
56 esac
57 done
59 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
60 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
61 INSTALL_DIR="${BUILD_DIR}/install"
63 function clean() {
64 rm -rf "${BUILD_DIR}"
67 # Print the version of a few tools to aid diagnostics in some cases
68 cmake --version
69 ninja --version
71 case "${BUILDER}" in
72 check-format)
73 echo "*** Checking for trailing whitespace left in Clang source files ***"
74 if grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs; then
75 echo "*** Trailing whitespace has been found in Clang source files as described above ***"
76 exit 1
79 build-clang)
80 mkdir install
81 # We use Release here to avoid including debug information. Otherwise, the
82 # clang binary is very large, which is problematic because we need to upload
83 # the artifacts for other jobs to use. This may seem like nothing, but with
84 # the number of jobs we run daily, this can result in thousands of GB of
85 # network I/O.
86 cmake \
87 -S llvm \
88 -B ${BUILD_DIR} \
89 -G Ninja \
90 -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
91 -DCMAKE_BUILD_TYPE=Release \
92 -DCMAKE_INSTALL_PREFIX=install \
93 -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \
95 ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
96 ccache -s
97 tar -cJvf install.tar.xz install/
98 buildkite-agent artifact upload --debug install.tar.xz
100 ninja -C ${BUILD_DIR} check-clang
102 build-clang-windows)
103 cmake -S llvm -B ${BUILD_DIR} -G Ninja \
104 -D CMAKE_C_COMPILER_LAUNCHER=sccache \
105 -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
106 -D CMAKE_BUILD_TYPE=Release \
107 -D CMAKE_INSTALL_PREFIX=install-windows \
108 -D LLVM_ENABLE_PROJECTS="clang;compiler-rt" \
109 -D LLVM_ENABLE_ASSERTIONS=ON \
110 -D LLVM_BUILD_EXAMPLES=ON \
111 -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
112 -D COMPILER_RT_BUILD_ORC=OFF
114 ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
115 ninja -C ${BUILD_DIR} check-clang
117 generic-cxx03)
118 buildkite-agent artifact download install.tar.xz .
119 tar -xvf install.tar.xz
120 export CC=$(pwd)/install/bin/clang
121 export CXX=$(pwd)/install/bin/clang++
122 chmod +x install/bin/clang install/bin/clang++
124 clean
125 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${BUILD_DIR}" -GNinja \
126 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
127 -DLIBCXX_CXX_ABI=libcxxabi \
128 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
129 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
130 -DLIBCXX_TEST_PARAMS="std=c++03" \
131 -DLIBCXXABI_TEST_PARAMS="std=c++03"
133 ninja -vC "${BUILD_DIR}" check-runtimes
135 generic-cxx26)
136 buildkite-agent artifact download install.tar.xz .
137 tar -xvf install.tar.xz
138 export CC=$(pwd)/install/bin/clang
139 export CXX=$(pwd)/install/bin/clang++
140 chmod +x install/bin/clang install/bin/clang++
142 clean
143 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${BUILD_DIR}" -GNinja \
144 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
145 -DLIBCXX_CXX_ABI=libcxxabi \
146 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
147 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
148 -DLIBCXX_TEST_PARAMS="std=c++26" \
149 -DLIBCXXABI_TEST_PARAMS="std=c++26"
151 ninja -vC "${BUILD_DIR}" check-runtimes
153 generic-modules)
154 buildkite-agent artifact download install.tar.xz .
155 tar -xvf install.tar.xz
156 export CC=$(pwd)/install/bin/clang
157 export CXX=$(pwd)/install/bin/clang++
158 chmod +x install/bin/clang install/bin/clang++
160 clean
161 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${BUILD_DIR}" -GNinja \
162 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
163 -DLIBCXX_CXX_ABI=libcxxabi \
164 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
165 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
166 -DLIBCXX_TEST_PARAMS="enable_modules=clang" \
167 -DLIBCXXABI_TEST_PARAMS="enable_modules=clang"
169 ninja -vC "${BUILD_DIR}" check-runtimes
171 #################################################################
172 # Insert vendor-specific internal configurations below.
174 # This allows vendors to extend this file with their own internal
175 # configurations without running into merge conflicts with upstream.
176 #################################################################
178 #################################################################
180 echo "${BUILDER} is not a known configuration"
181 exit 1
183 esac