Skip to content

Commit dd46457

Browse files
committed
Merge tag 'llvmorg-19.1.1' into rustc/19.1-2024-09-17
LLVM Release 19.1.1
2 parents 5699773 + d401987 commit dd46457

File tree

88 files changed

+2388
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2388
-348
lines changed

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,8 @@ jobs:
135135
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
136136
fi
137137
138-
# x86 macOS and x86 Windows have trouble building flang, so disable it.
139-
# Windows: https://github.com/llvm/llvm-project/issues/100202
140-
# macOS: 'rebase opcodes terminated early at offset 1 of 80016' when building __fortran_builtins.mod
141138
build_flang="true"
142139
143-
if [ "$target" = "Windows-X64" ]; then
144-
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS=\"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir\""
145-
build_flang="false"
146-
fi
147-
148140
if [ "${{ runner.os }}" = "Windows" ]; then
149141
# The build times out on Windows, so we need to disable LTO.
150142
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"

bolt/test/perf2bolt/lit.local.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import shutil
2+
import subprocess
23

3-
if shutil.which("perf") is not None:
4-
config.available_features.add("perf")
4+
if shutil.which("perf") is not None and subprocess.run(["perf", "record", "-e", "cycles:u", "-o", "/dev/null", "--", "perf", "--version"], capture_output=True).returncode == 0:
5+
config.available_features.add("perf")

clang/cmake/caches/Release.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
4747
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
4848

4949
set(STAGE1_PROJECTS "clang")
50-
set(STAGE1_RUNTIMES "")
50+
51+
# Building Flang on Windows requires compiler-rt, so we need to build it in
52+
# stage1. compiler-rt is also required for building the Flang tests on
53+
# macOS.
54+
set(STAGE1_RUNTIMES "compiler-rt")
5155

5256
if (LLVM_RELEASE_ENABLE_PGO)
5357
list(APPEND STAGE1_PROJECTS "lld")
54-
list(APPEND STAGE1_RUNTIMES "compiler-rt")
5558
set(CLANG_BOOTSTRAP_TARGETS
5659
generate-profdata
5760
stage2-package

clang/include/clang/AST/DeclBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ class alignas(8) Decl {
680680
/// Whether this declaration comes from explicit global module.
681681
bool isFromExplicitGlobalModule() const;
682682

683+
/// Whether this declaration comes from global module.
684+
bool isFromGlobalModule() const;
685+
683686
/// Whether this declaration comes from a named module.
684687
bool isInNamedModule() const;
685688

clang/include/clang/Tooling/CompilationDatabase.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ std::unique_ptr<CompilationDatabase>
234234
std::unique_ptr<CompilationDatabase>
235235
inferTargetAndDriverMode(std::unique_ptr<CompilationDatabase> Base);
236236

237+
/// Returns a wrapped CompilationDatabase that will transform argv[0] to an
238+
/// absolute path, if it currently is a plain tool name, looking it up in
239+
/// PATH.
240+
std::unique_ptr<CompilationDatabase>
241+
inferToolLocation(std::unique_ptr<CompilationDatabase> Base);
242+
237243
/// Returns a wrapped CompilationDatabase that will expand all rsp(response)
238244
/// files on commandline returned by underlying database.
239245
std::unique_ptr<CompilationDatabase>

clang/lib/AST/DeclBase.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,10 @@ bool Decl::isFromExplicitGlobalModule() const {
11611161
return getOwningModule() && getOwningModule()->isExplicitGlobalModule();
11621162
}
11631163

1164+
bool Decl::isFromGlobalModule() const {
1165+
return getOwningModule() && getOwningModule()->isGlobalModule();
1166+
}
1167+
11641168
bool Decl::isInNamedModule() const {
11651169
return getOwningModule() && getOwningModule()->isNamedModule();
11661170
}

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,18 +2833,22 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
28332833
llvm::AtomicOrdering::SequentiallyConsistent);
28342834
return isPre ? Builder.CreateBinOp(op, old, amt) : old;
28352835
}
2836-
// Special case for atomic increment/decrement on floats
2836+
// Special case for atomic increment/decrement on floats.
2837+
// Bail out non-power-of-2-sized floating point types (e.g., x86_fp80).
28372838
if (type->isFloatingType()) {
2838-
llvm::AtomicRMWInst::BinOp aop =
2839-
isInc ? llvm::AtomicRMWInst::FAdd : llvm::AtomicRMWInst::FSub;
2840-
llvm::Instruction::BinaryOps op =
2841-
isInc ? llvm::Instruction::FAdd : llvm::Instruction::FSub;
2842-
llvm::Value *amt = llvm::ConstantFP::get(
2843-
VMContext, llvm::APFloat(static_cast<float>(1.0)));
2844-
llvm::Value *old =
2845-
Builder.CreateAtomicRMW(aop, LV.getAddress(), amt,
2846-
llvm::AtomicOrdering::SequentiallyConsistent);
2847-
return isPre ? Builder.CreateBinOp(op, old, amt) : old;
2839+
llvm::Type *Ty = ConvertType(type);
2840+
if (llvm::has_single_bit(Ty->getScalarSizeInBits())) {
2841+
llvm::AtomicRMWInst::BinOp aop =
2842+
isInc ? llvm::AtomicRMWInst::FAdd : llvm::AtomicRMWInst::FSub;
2843+
llvm::Instruction::BinaryOps op =
2844+
isInc ? llvm::Instruction::FAdd : llvm::Instruction::FSub;
2845+
llvm::Value *amt = llvm::ConstantFP::get(Ty, 1.0);
2846+
llvm::AtomicRMWInst *old = Builder.CreateAtomicRMW(
2847+
aop, LV.getAddress(), amt,
2848+
llvm::AtomicOrdering::SequentiallyConsistent);
2849+
2850+
return isPre ? Builder.CreateBinOp(op, old, amt) : old;
2851+
}
28482852
}
28492853
value = EmitLoadOfLValue(LV, E->getExprLoc());
28502854
input = value;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8561,6 +8561,32 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
85618561
WantDebug = !A->getOption().matches(options::OPT_g0) &&
85628562
!A->getOption().matches(options::OPT_ggdb0);
85638563

8564+
// If a -gdwarf argument appeared, remember it.
8565+
bool EmitDwarf = false;
8566+
if (const Arg *A = getDwarfNArg(Args))
8567+
EmitDwarf = checkDebugInfoOption(A, Args, D, getToolChain());
8568+
8569+
bool EmitCodeView = false;
8570+
if (const Arg *A = Args.getLastArg(options::OPT_gcodeview))
8571+
EmitCodeView = checkDebugInfoOption(A, Args, D, getToolChain());
8572+
8573+
// If the user asked for debug info but did not explicitly specify -gcodeview
8574+
// or -gdwarf, ask the toolchain for the default format.
8575+
if (!EmitCodeView && !EmitDwarf && WantDebug) {
8576+
switch (getToolChain().getDefaultDebugFormat()) {
8577+
case llvm::codegenoptions::DIF_CodeView:
8578+
EmitCodeView = true;
8579+
break;
8580+
case llvm::codegenoptions::DIF_DWARF:
8581+
EmitDwarf = true;
8582+
break;
8583+
}
8584+
}
8585+
8586+
// If the arguments don't imply DWARF, don't emit any debug info here.
8587+
if (!EmitDwarf)
8588+
WantDebug = false;
8589+
85648590
llvm::codegenoptions::DebugInfoKind DebugInfoKind =
85658591
llvm::codegenoptions::NoDebugInfo;
85668592

clang/lib/Format/FormatTokenLexer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ ArrayRef<FormatToken *> FormatTokenLexer::lex() {
100100
if (Tokens.back()->NewlinesBefore > 0 || Tokens.back()->IsMultiline)
101101
FirstInLineIndex = Tokens.size() - 1;
102102
} while (Tokens.back()->isNot(tok::eof));
103+
if (Style.InsertNewlineAtEOF) {
104+
auto &TokEOF = *Tokens.back();
105+
if (TokEOF.NewlinesBefore == 0) {
106+
TokEOF.NewlinesBefore = 1;
107+
TokEOF.OriginalColumn = 0;
108+
}
109+
}
103110
return Tokens;
104111
}
105112

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,11 +3680,6 @@ void TokenAnnotator::annotate(AnnotatedLine &Line) {
36803680
auto *First = Line.First;
36813681
First->SpacesRequiredBefore = 1;
36823682
First->CanBreakBefore = First->MustBreakBefore;
3683-
3684-
if (First->is(tok::eof) && First->NewlinesBefore == 0 &&
3685-
Style.InsertNewlineAtEOF) {
3686-
First->NewlinesBefore = 1;
3687-
}
36883683
}
36893684

36903685
// This function heuristically determines whether 'Current' starts the name of a

0 commit comments

Comments
 (0)