Skip to content

Update LLVM to 19.1.4 #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a3f0f1d
Bump version to 19.1.4
tru Nov 11, 2024
d174e2a
[compiler-rt] [fuzzer] Skip trying to set the thread name on MinGW (#…
mstorsjo Nov 6, 2024
2d8ee3a
[RISCV] Don't delete all fixups in RISCVMCCodeEmitter::expandLongCond…
topperc Sep 23, 2024
430c495
[compiler-rt] [test] Fix using toolchains that rely on Clang default …
mstorsjo Oct 24, 2024
7b6ee6e
[clang-format] Fix a regression in parsing `switch` in macro call (#1…
owenca Nov 2, 2024
33c4723
release/19.x: [Clang] Consider outer instantiation scopes for constra…
zyn0217 Nov 5, 2024
76ca2e0
[LoongArch][Clang] Add tests for #110834 (#114509)
xry111 Nov 2, 2024
6a668bc
[LoongArch][clang] Use `signed char` vectors instead of `char` vector…
xry111 Nov 2, 2024
3f9b36d
[LoongArch][Clang] Make the parameter and return value of {x,}vmsknz.…
xry111 Nov 2, 2024
0c5f639
[LoongArch][Clang] Make the parameters and return value of {x,}vshuf.…
xry111 Nov 4, 2024
499eae9
[LoongArch][Clang] Make the parameters and return value of {x,}vxor.v…
xry111 Nov 4, 2024
19026a4
[compiler-rt] Stop using x86 builtin on AArch64 with GCC (#93890)
XrXr Aug 16, 2024
ec947f9
[clang-repl] Fix undefined lld::wasm::link symbol while building clan…
anutosh491 Oct 25, 2024
ffc4825
[InstCombine] Intersect nowrap flags between geps while folding into phi
antoniofrighetto Nov 12, 2024
81005af
[llvm][aarch64] Fix Arm64EC name mangling algorithm (#115567)
dpaoliello Nov 13, 2024
c9e8540
[clang] Fix C23 constexpr crashes (#112708)
Fznamznon Oct 18, 2024
863b2e5
[C++20] [Modules] Fix the duplicated static initializer problem (#114…
ChuanqiXu9 Oct 30, 2024
ec2e1ca
[libc++] Fix broken configuration system-libcxxabi on Apple (#110920)
ldionne Oct 9, 2024
c9b952e
[InstCombine] Drop nsw in negation of select (#112893)
dtcxzyw Nov 8, 2024
54bc386
[SystemZ] Use the EVT version of getVectorVT() in combineTruncateExtr…
JonPsson1 Jul 26, 2024
9fdf912
[MSVC] work-around for compile time issue 102513
bd1976bris Oct 6, 2024
6925f3c
Reapply "[sanitizer_common] AND signals in BlockSignals instead of de…
thurstond Nov 14, 2024
aadaa00
[WebAssembly] Fix rethrow's index calculation (#114693)
aheejin Nov 6, 2024
b73591a
Merge tag 'llvmorg-19.1.4' into llvm-19.1.4
Earlopain Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 73 additions & 73 deletions clang/include/clang/Basic/BuiltinsLoongArchLASX.def

Large diffs are not rendered by default.

132 changes: 66 additions & 66 deletions clang/include/clang/Basic/BuiltinsLoongArchLSX.def

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,8 @@ bool VarDecl::isUsableInConstantExpressions(const ASTContext &Context) const {
if (!DefVD->mightBeUsableInConstantExpressions(Context))
return false;
// ... and its initializer is a constant initializer.
if (Context.getLangOpts().CPlusPlus && !DefVD->hasConstantInitialization())
if ((Context.getLangOpts().CPlusPlus || getLangOpts().C23) &&
!DefVD->hasConstantInitialization())
return false;
// C++98 [expr.const]p1:
// An integral constant-expression can involve only [...] const variables
Expand Down Expand Up @@ -2610,8 +2611,11 @@ bool VarDecl::hasICEInitializer(const ASTContext &Context) const {
}

bool VarDecl::hasConstantInitialization() const {
// In C, all globals (and only globals) have constant initialization.
if (hasGlobalStorage() && !getASTContext().getLangOpts().CPlusPlus)
// In C, all globals and constexpr variables should have constant
// initialization. For constexpr variables in C check that initializer is a
// constant initializer because they can be used in constant expressions.
if (hasGlobalStorage() && !getASTContext().getLangOpts().CPlusPlus &&
!isConstexpr())
return true;

// In C++, it depends on whether the evaluation at the point of definition
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/AST/Interp/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ void diagnoseEnumValue(InterpState &S, CodePtr OpPC, const EnumDecl *ED,
}
}

// https://github.com/llvm/llvm-project/issues/102513
#if defined(_WIN32) && !defined(__clang__) && !defined(NDEBUG)
#pragma optimize("", off)
#endif
bool Interpret(InterpState &S, APValue &Result) {
// The current stack frame when we started Interpret().
// This is being used by the ops to determine wheter
Expand All @@ -949,6 +953,10 @@ bool Interpret(InterpState &S, APValue &Result) {
}
}
}
// https://github.com/llvm/llvm-project/issues/102513
#if defined(_WIN32) && !defined(__clang__) && !defined(NDEBUG)
#pragma optimize("", on)
#endif

} // namespace interp
} // namespace clang
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7080,8 +7080,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
// For C++ standard modules we are done - we will call the module
// initializer for imported modules, and that will likewise call those for
// any imports it has.
if (CXX20ModuleInits && Import->getImportedOwningModule() &&
!Import->getImportedOwningModule()->isModuleMapModule())
if (CXX20ModuleInits && Import->getImportedModule() &&
Import->getImportedModule()->isNamedModule())
break;

// For clang C++ module map modules the initializers for sub-modules are
Expand Down
8 changes: 6 additions & 2 deletions clang/lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,8 @@ void UnwrappedLineParser::parseStructuralElement(
case tok::kw_switch:
if (Style.Language == FormatStyle::LK_Java)
parseSwitch(/*IsExpr=*/true);
nextToken();
else
nextToken();
break;
case tok::kw_case:
// Proto: there are no switch/case statements.
Expand Down Expand Up @@ -2637,7 +2638,10 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) {
nextToken();
break;
case tok::kw_switch:
parseSwitch(/*IsExpr=*/true);
if (Style.Language == FormatStyle::LK_Java)
parseSwitch(/*IsExpr=*/true);
else
nextToken();
break;
case tok::kw_requires: {
auto RequiresToken = FormatTok;
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS

if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
set(WASM_SRC Wasm.cpp)
set(WASM_LINK lldWasm)
endif()

add_clang_library(clangInterpreter
Expand Down Expand Up @@ -43,6 +44,7 @@ add_clang_library(clangInterpreter
clangParse
clangSema
clangSerialization
${WASM_LINK}
)

if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
// parameters that the surrounding function hasn't been instantiated yet. Note
// this may happen while we're comparing two templates' constraint
// equivalence.
LocalInstantiationScope ScopeForParameters(S);
LocalInstantiationScope ScopeForParameters(S, /*CombineWithOuterScope=*/true);
if (auto *FD = DeclInfo.getDecl()->getAsFunction())
for (auto *PVD : FD->parameters()) {
if (!PVD->isParameterPack()) {
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Headers/lasxintrin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lasx
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lasx -flax-vector-conversions=none
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lasx -flax-vector-conversions=none -fno-signed-char

#include <lasxintrin.h>
5 changes: 5 additions & 0 deletions clang/test/Headers/lsxintrin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lsx
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lsx -flax-vector-conversions=none
// RUN: %clang_cc1 %s -fsyntax-only -triple loongarch64 -target-feature +lsx -flax-vector-conversions=none -fno-signed-char

#include <lsxintrin.h>
18 changes: 18 additions & 0 deletions clang/test/Modules/static-initializer.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cpp

//--- a.cppm
export module a;
int func();
static int a = func();

//--- a.cpp
import a;

// CHECK-NOT: internal global
// CHECK-NOT: __cxx_global_var_init

17 changes: 17 additions & 0 deletions clang/test/Sema/constexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,20 @@ void constexprif() {
void constevalif() {
if consteval (300) {} //expected-error {{expected '(' after 'if'}}
}

struct S11 {
int len;
};
void ghissue112516() {
struct S11 *s11 = 0;
constexpr int num = s11->len; // expected-error {{constexpr variable 'num' must be initialized by a constant expression}}
void *Arr[num];
}

void ghissue109095() {
constexpr char c[] = { 'a' };
constexpr int i = c[1]; // expected-error {{constexpr variable 'i' must be initialized by a constant expression}}\
// expected-note {{declared here}}
_Static_assert(i == c[0]); // expected-error {{static assertion expression is not an integral constant expression}}\
// expected-note {{initializer of 'i' is not a constant expression}}
}
16 changes: 16 additions & 0 deletions clang/test/SemaTemplate/concepts-out-of-line-def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,19 @@ void A<T>::method(Ts&... ts)
} {}

}

namespace GH114685 {

template <typename T> struct ptr {
template <typename U>
friend ptr<U> make_item(auto &&args)
requires(sizeof(args) > 1);
};

template <typename U>
ptr<U> make_item(auto &&args)
requires(sizeof(args) > 1) {}

ptr<char> p;

} // namespace GH114685
7 changes: 7 additions & 0 deletions clang/unittests/Format/TokenAnnotatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3412,6 +3412,13 @@ TEST_F(TokenAnnotatorTest, TemplateInstantiation) {
EXPECT_TOKEN(Tokens[18], tok::greater, TT_TemplateCloser);
}

TEST_F(TokenAnnotatorTest, SwitchInMacroArgument) {
auto Tokens = annotate("FOOBAR(switch);\n"
"void f() {}");
ASSERT_EQ(Tokens.size(), 12u) << Tokens;
EXPECT_TOKEN(Tokens[9], tok::l_brace, TT_FunctionLBrace);
}

} // namespace
} // namespace format
} // namespace clang
2 changes: 1 addition & 1 deletion cmake/Modules/LLVMVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
set(LLVM_VERSION_MINOR 1)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
set(LLVM_VERSION_PATCH 3)
set(LLVM_VERSION_PATCH 4)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
set(LLVM_VERSION_SUFFIX)
Expand Down
16 changes: 16 additions & 0 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ include(CompilerRTUtils)
include(CMakeDependentOption)
include(GetDarwinLinkerVersion)

include(CheckCXXCompilerFlag)

# Check if we can compile with --no-default-config, or if that omits a config
# file that is essential for the toolchain to work properly.
#
# Using CMAKE_REQUIRED_FLAGS to make sure the flag is used both for compilation
# and for linking.
#
# Doing this test early on, to see if the flag works on the toolchain
# out of the box. Later on, we end up adding -nostdlib and similar flags
# to all test compiles, which easily can give false positives on this test.
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --no-default-config")
check_cxx_compiler_flag("" COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG)
set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}")

option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
option(COMPILER_RT_DISABLE_AARCH64_FMV "Disable AArch64 Function Multi Versioning support" OFF)
Expand Down
13 changes: 9 additions & 4 deletions compiler-rt/lib/builtins/int_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@
#define crt_copysign(x, y) __builtin_copysign((x), (y))
#define crt_copysignf(x, y) __builtin_copysignf((x), (y))
#define crt_copysignl(x, y) __builtin_copysignl((x), (y))
#if __has_builtin(__builtin_copysignf128)
// We define __has_builtin to always return 0 for GCC versions below 10,
// but __builtin_copysignf128 is available since version 7.
#if __has_builtin(__builtin_copysignf128) || \
(defined(__GNUC__) && __GNUC__ >= 7)
#define crt_copysignf128(x, y) __builtin_copysignf128((x), (y))
#elif __has_builtin(__builtin_copysignq) || (defined(__GNUC__) && __GNUC__ >= 7)
#elif __has_builtin(__builtin_copysignq)
#define crt_copysignf128(x, y) __builtin_copysignq((x), (y))
#endif
#endif
Expand All @@ -80,9 +83,11 @@
#define crt_fabs(x) __builtin_fabs((x))
#define crt_fabsf(x) __builtin_fabsf((x))
#define crt_fabsl(x) __builtin_fabsl((x))
#if __has_builtin(__builtin_fabsf128)
// We define __has_builtin to always return 0 for GCC versions below 10,
// but __builtin_fabsf128 is available since version 7.
#if __has_builtin(__builtin_fabsf128) || (defined(__GNUC__) && __GNUC__ >= 7)
#define crt_fabsf128(x) __builtin_fabsf128((x))
#elif __has_builtin(__builtin_fabsq) || (defined(__GNUC__) && __GNUC__ >= 7)
#elif __has_builtin(__builtin_fabsq)
#define crt_fabsf128(x) __builtin_fabsq((x))
#endif
#endif
Expand Down
9 changes: 5 additions & 4 deletions compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ size_t PageSize() {
}

void SetThreadName(std::thread &thread, const std::string &name) {
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
defined(_GLIBCXX_GCC_GTHR_POSIX_H)
(void)pthread_setname_np(thread.native_handle(), name.c_str());
#else
#ifndef __MINGW32__
// Not setting the thread name in MinGW environments. MinGW C++ standard
// libraries can either use native Windows threads or pthreads, so we
// don't know with certainty what kind of thread handle we're getting
// from thread.native_handle() here.
typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
HMODULE kbase = GetModuleHandleA("KernelBase.dll");
proc ThreadNameProc =
Expand Down
55 changes: 39 additions & 16 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,33 +160,56 @@ void SetSigProcMask(__sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset) {
CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, set, oldset));
}

# if SANITIZER_LINUX
// Deletes the specified signal from newset, if it is not present in oldset
// Equivalently: newset[signum] = newset[signum] & oldset[signum]
static void KeepUnblocked(__sanitizer_sigset_t &newset,
__sanitizer_sigset_t &oldset, int signum) {
// FIXME: https://github.com/google/sanitizers/issues/1816
if (SANITIZER_ANDROID || !internal_sigismember(&oldset, signum))
internal_sigdelset(&newset, signum);
}
# endif

// Block asynchronous signals
void BlockSignals(__sanitizer_sigset_t *oldset) {
__sanitizer_sigset_t set;
internal_sigfillset(&set);
# if SANITIZER_LINUX && !SANITIZER_ANDROID
__sanitizer_sigset_t newset;
internal_sigfillset(&newset);

# if SANITIZER_LINUX
__sanitizer_sigset_t currentset;

# if !SANITIZER_ANDROID
// FIXME: https://github.com/google/sanitizers/issues/1816
SetSigProcMask(NULL, &currentset);

// Glibc uses SIGSETXID signal during setuid call. If this signal is blocked
// on any thread, setuid call hangs.
// See test/sanitizer_common/TestCases/Linux/setuid.c.
internal_sigdelset(&set, 33);
# endif
# if SANITIZER_LINUX
KeepUnblocked(newset, currentset, 33);
# endif // !SANITIZER_ANDROID

// Seccomp-BPF-sandboxed processes rely on SIGSYS to handle trapped syscalls.
// If this signal is blocked, such calls cannot be handled and the process may
// hang.
internal_sigdelset(&set, 31);
KeepUnblocked(newset, currentset, 31);

# if !SANITIZER_ANDROID
// Don't block synchronous signals
internal_sigdelset(&set, SIGSEGV);
internal_sigdelset(&set, SIGBUS);
internal_sigdelset(&set, SIGILL);
internal_sigdelset(&set, SIGTRAP);
internal_sigdelset(&set, SIGABRT);
internal_sigdelset(&set, SIGFPE);
internal_sigdelset(&set, SIGPIPE);
# endif
// but also don't unblock signals that the user had deliberately blocked.
// FIXME: https://github.com/google/sanitizers/issues/1816
KeepUnblocked(newset, currentset, SIGSEGV);
KeepUnblocked(newset, currentset, SIGBUS);
KeepUnblocked(newset, currentset, SIGILL);
KeepUnblocked(newset, currentset, SIGTRAP);
KeepUnblocked(newset, currentset, SIGABRT);
KeepUnblocked(newset, currentset, SIGFPE);
KeepUnblocked(newset, currentset, SIGPIPE);
# endif //! SANITIZER_ANDROID

# endif // SANITIZER_LINUX

SetSigProcMask(&set, oldset);
SetSigProcMask(&newset, oldset);
}

ScopedBlockSignals::ScopedBlockSignals(__sanitizer_sigset_t *copy) {
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(SANITIZER_UNITTESTS
sanitizer_array_ref_test.cpp
sanitizer_atomic_test.cpp
sanitizer_bitvector_test.cpp
sanitizer_block_signals.cpp
sanitizer_bvgraph_test.cpp
sanitizer_chained_origin_depot_test.cpp
sanitizer_common_test.cpp
Expand Down
Loading