Skip to content

Commit 9ba2a11

Browse files
carlocabBrewTestBot
authored andcommitted
llvm 15.0.2
* llvm 15.0.2 * llvm: improve `install` method - define an `lto_build` variable per feedback from #112154 - move the runtimes build from `stage2-profdata` to `stage2`. Building the runtimes is not useful with the `stage2-profdata` compiler, but doing it in `stage2` means that the runtimes will be built with our instrumented compiler.
1 parent 4b14798 commit 9ba2a11

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Formula/llvm.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Llvm < Formula
22
desc "Next-gen compiler infrastructure"
33
homepage "https://llvm.org/"
4-
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.1/llvm-project-15.0.1.src.tar.xz"
5-
sha256 "f25ce2d4243bebf527284eb7be7f6f56ef454fca8b3de9523f7eb4efb8d26218"
4+
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/llvm-project-15.0.2.src.tar.xz"
5+
sha256 "7877cd67714728556a79e5ec0cc72d66b6926448cf73b12b2cb901b268f7a872"
66
# The LLVM Project is under the Apache License v2.0 with LLVM Exceptions
77
license "Apache-2.0" => { with: "LLVM-exception" }
88
head "https://github.com/llvm/llvm-project.git", branch: "main"
@@ -142,12 +142,6 @@ def install
142142
runtimes_cmake_args = []
143143
builtins_cmake_args = []
144144

145-
# Skip the PGO build on HEAD installs or non-bottle source builds
146-
# Catalina and earlier requires too many hacks to build with PGO.
147-
# FIXME: The Linux build appears to have a parallelisation issue,
148-
# so avoid a painfully slow serial build until that's resolved.
149-
pgo_build = build.stable? && build.bottle? && (MacOS.version > :catalina)
150-
151145
if OS.mac?
152146
args << "-DLLVM_BUILD_LLVM_C_DYLIB=ON"
153147
args << "-DLLVM_ENABLE_LIBCXX=ON"
@@ -204,6 +198,13 @@ def install
204198
builtins_cmake_args << "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
205199
end
206200

201+
# Skip the PGO build on HEAD installs or non-bottle source builds
202+
# Catalina and earlier requires too many hacks to build with PGO.
203+
# FIXME: The Linux build appears to have a parallelisation issue,
204+
# so avoid a painfully slow serial build until that's resolved.
205+
pgo_build = build.stable? && build.bottle? && (MacOS.version > :catalina)
206+
lto_build = pgo_build && OS.mac?
207+
207208
if ENV.cflags.present?
208209
args << "-DCMAKE_C_FLAGS=#{ENV.cflags}" unless pgo_build
209210
runtimes_cmake_args << "-DCMAKE_C_FLAGS=#{ENV.cflags}"
@@ -250,9 +251,7 @@ def install
250251
extra_args << "-DCMAKE_LINKER=ld"
251252
extra_args += clt_sdk_support_flags
252253

253-
# NOTE: do not enable LTO on Linux, because this creates static archives that are not portable.
254-
# This is not an issue on macOS, where bottles are built and installed on the same version.
255-
args << "-DLLVM_ENABLE_LTO=Thin"
254+
args << "-DLLVM_ENABLE_LTO=Thin" if lto_build
256255
# LTO creates object files not recognised by Apple libtool.
257256
args << "-DCMAKE_LIBTOOL=#{llvmpath}/stage1/bin/llvm-libtool-darwin"
258257

@@ -336,7 +335,7 @@ def install
336335
"-DCMAKE_C_FLAGS=#{instrumented_cflags.join(" ")}",
337336
"-DCMAKE_CXX_FLAGS=#{instrumented_cxxflags.join(" ")}",
338337
*instrumented_extra_args, *std_cmake_args
339-
system "cmake", "--build", ".", "--target", "clang", "lld"
338+
system "cmake", "--build", ".", "--target", "clang", "lld", "runtimes"
340339

341340
# We run some `check-*` targets to increase profiling
342341
# coverage. These do not need to succeed.
@@ -352,6 +351,7 @@ def install
352351
system "cmake", "-G", "Unix Makefiles", "..",
353352
"-DCMAKE_C_COMPILER=#{llvmpath}/stage2/bin/clang",
354353
"-DCMAKE_CXX_COMPILER=#{llvmpath}/stage2/bin/clang++",
354+
"-DLLVM_BUILD_RUNTIMES=OFF",
355355
*extra_args.reject { |s| s["TABLEGEN"] },
356356
*std_cmake_args
357357

@@ -434,7 +434,7 @@ def install
434434
# Install Emacs modes
435435
elisp.install llvmpath.glob("utils/emacs/*.el") + share.glob("clang/*.el")
436436

437-
return if OS.linux? || !pgo_build
437+
return unless lto_build
438438

439439
# Convert LTO-generated bitcode in our static archives to MachO. Adapted from Fedora:
440440
# https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/brp-llvm-compile-lto-elf

0 commit comments

Comments
 (0)