Skip to content

Commit 939a9ce

Browse files
authored
[upstream_utils] Upgrade to LLVM 19.1.6 (#7101)
1 parent b670a59 commit 939a9ce

File tree

70 files changed

+2127
-799
lines changed

Some content is hidden

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

70 files changed

+2127
-799
lines changed

upstream_utils/llvm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def run_global_replacements(wpiutil_llvm_files):
1313

1414
# Rename namespace from llvm to wpi
1515
content = content.replace("namespace llvm", "namespace wpi")
16-
content = content.replace("llvm::", "wpi::")
16+
content = content.replace("llvm:", "wpi:")
1717

1818
# Fix #includes
1919
content = content.replace('include "llvm/ADT', 'include "wpi')
@@ -175,7 +175,7 @@ def copy_upstream_src(wpilib_root):
175175
def main():
176176
name = "llvm"
177177
url = "https://github.com/llvm/llvm-project"
178-
tag = "llvmorg-18.1.8"
178+
tag = "llvmorg-19.1.6"
179179

180180
patch_options = {
181181
"use_threeway": True,

upstream_utils/llvm_patches/0001-Remove-StringRef-ArrayRef-and-Optional.patch

+98-86
Large diffs are not rendered by default.

upstream_utils/llvm_patches/0002-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: PJ Reiniger <[email protected]>
33
Date: Sat, 7 May 2022 22:12:41 -0400
4-
Subject: [PATCH 02/36] Wrap std::min/max calls in parens, for Windows warnings
4+
Subject: [PATCH 02/37] Wrap std::min/max calls in parens, for Windows warnings
55

66
---
77
llvm/include/llvm/ADT/DenseMap.h | 4 ++--
88
llvm/include/llvm/ADT/SmallVector.h | 6 +++---
99
llvm/include/llvm/Support/ConvertUTF.h | 2 +-
10-
llvm/include/llvm/Support/MathExtras.h | 18 +++++++++---------
11-
4 files changed, 15 insertions(+), 15 deletions(-)
10+
llvm/include/llvm/Support/MathExtras.h | 20 ++++++++++----------
11+
4 files changed, 16 insertions(+), 16 deletions(-)
1212

1313
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
14-
index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004be6facafb 100644
14+
index 7ccc9445c0a7b882b424b2431858ea596d0eb58f..c4764fffa845a7f9eb69f262aa0ee728d08b1655 100644
1515
--- a/llvm/include/llvm/ADT/DenseMap.h
1616
+++ b/llvm/include/llvm/ADT/DenseMap.h
17-
@@ -416,7 +416,7 @@ protected:
17+
@@ -432,7 +432,7 @@ protected:
1818
return 0;
1919
// +1 is required because of the strict equality.
2020
// For example if NumEntries is 48, we need to return 401.
@@ -23,7 +23,7 @@ index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004b
2323
}
2424

2525
void moveFromOldBuckets(BucketT *OldBucketsBegin, BucketT *OldBucketsEnd) {
26-
@@ -852,7 +852,7 @@ public:
26+
@@ -868,7 +868,7 @@ public:
2727
// Reduce the number of buckets.
2828
unsigned NewNumBuckets = 0;
2929
if (OldNumEntries)
@@ -33,10 +33,10 @@ index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004b
3333
this->BaseT::initEmpty();
3434
return;
3535
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
36-
index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad62e06e973 100644
36+
index 94d8da059f4f8bad50039b0d0b7993396707829c..85bf5172e419b1b58f53d3cf00d4aabb58877c33 100644
3737
--- a/llvm/include/llvm/ADT/SmallVector.h
3838
+++ b/llvm/include/llvm/ADT/SmallVector.h
39-
@@ -55,7 +55,7 @@ protected:
39+
@@ -56,7 +56,7 @@ protected:
4040

4141
/// The maximum value of the Size_T used.
4242
static constexpr size_t SizeTypeMax() {
@@ -45,7 +45,7 @@ index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad6
4545
}
4646

4747
SmallVectorBase() = delete;
48-
@@ -289,7 +289,7 @@ public:
48+
@@ -290,7 +290,7 @@ public:
4949

5050
size_type size_in_bytes() const { return size() * sizeof(T); }
5151
size_type max_size() const {
@@ -54,7 +54,7 @@ index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad6
5454
}
5555

5656
size_t capacity_in_bytes() const { return capacity() * sizeof(T); }
57-
@@ -721,7 +721,7 @@ public:
57+
@@ -722,7 +722,7 @@ public:
5858
}
5959

6060
// Assign over existing elements.
@@ -77,10 +77,10 @@ index 5c0e3009c25446a34882fb98329b1d955231bb39..72321022beb373945f7935ed72944fd6
7777
/* Some fundamental constants */
7878
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
7979
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
80-
index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c91ba725d 100644
80+
index e568e42afcf4d20dba137346953ff4be9d27ffc7..d9de2e92d5b07bce1d02ffcfda614b9079d2df91 100644
8181
--- a/llvm/include/llvm/Support/MathExtras.h
8282
+++ b/llvm/include/llvm/Support/MathExtras.h
83-
@@ -311,26 +311,26 @@ template <> constexpr inline size_t CTLog2<1>() { return 0; }
83+
@@ -338,26 +338,26 @@ template <> constexpr size_t CTLog2<1>() { return 0; }
8484
/// (32 bit edition.)
8585
/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2
8686
inline unsigned Log2_32(uint32_t Value) {
@@ -111,7 +111,16 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
111111
}
112112

113113
/// A and B are either alignments or offsets. Return the minimum alignment that
114-
@@ -482,7 +482,7 @@ SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
114+
@@ -417,7 +417,7 @@ constexpr uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator) {
115+
// happens only when Numerator = INT_MIN and Denominator = -1.
116+
template <typename U, typename V>
117+
constexpr bool divideSignedWouldOverflow(U Numerator, V Denominator) {
118+
- return Numerator == std::numeric_limits<U>::min() && Denominator == -1;
119+
+ return Numerator == (std::numeric_limits<U>::min)() && Denominator == -1;
120+
}
121+
122+
/// Returns the integer ceil(Numerator / Denominator). Signed version.
123+
@@ -605,7 +605,7 @@ SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
115124
T Z = X + Y;
116125
Overflowed = (Z < X || Z < Y);
117126
if (Overflowed)
@@ -120,7 +129,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
120129
else
121130
return Z;
122131
}
123-
@@ -495,7 +495,7 @@ std::enable_if_t<std::is_unsigned_v<T>, T> SaturatingAdd(T X, T Y, T Z,
132+
@@ -618,7 +618,7 @@ std::enable_if_t<std::is_unsigned_v<T>, T> SaturatingAdd(T X, T Y, T Z,
124133
bool Overflowed = false;
125134
T XY = SaturatingAdd(X, Y, &Overflowed);
126135
if (Overflowed)
@@ -129,7 +138,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
129138
return SaturatingAdd(XY, Z, Args...);
130139
}
131140

132-
@@ -519,7 +519,7 @@ SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
141+
@@ -642,7 +642,7 @@ SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
133142
// Special case: if X or Y is 0, Log2_64 gives -1, and Log2Z
134143
// will necessarily be less than Log2Max as desired.
135144
int Log2Z = Log2_64(X) + Log2_64(Y);
@@ -138,7 +147,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
138147
int Log2Max = Log2_64(Max);
139148
if (Log2Z < Log2Max) {
140149
return X * Y;
141-
@@ -639,9 +639,9 @@ std::enable_if_t<std::is_signed_v<T>, T> MulOverflow(T X, T Y, T &Result) {
150+
@@ -764,9 +764,9 @@ std::enable_if_t<std::is_signed_v<T>, T> MulOverflow(T X, T Y, T &Result) {
142151
// Check how the max allowed absolute value (2^n for negative, 2^(n-1) for
143152
// positive) divided by an argument compares to the other.
144153
if (IsNegative)
@@ -147,6 +156,6 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
147156
else
148157
- return UX > (static_cast<U>(std::numeric_limits<T>::max())) / UY;
149158
+ return UX > (static_cast<U>((std::numeric_limits<T>::max)())) / UY;
159+
#endif
150160
}
151161

152-
} // End llvm namespace

upstream_utils/llvm_patches/0003-Change-unique_function-storage-size.patch

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: PJ Reiniger <[email protected]>
33
Date: Sat, 7 May 2022 22:13:55 -0400
4-
Subject: [PATCH 03/36] Change unique_function storage size
4+
Subject: [PATCH 03/37] Change unique_function storage size
55

66
---
77
llvm/include/llvm/ADT/FunctionExtras.h | 4 ++--
88
1 file changed, 2 insertions(+), 2 deletions(-)
99

1010
diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h
11-
index c0bc30c7450fe4b2bc6b9b448824eedc8b132e52..5641a913d0a35ee2911cf872ad90c3dc864f20f5 100644
11+
index 49e0e8ab0db400d0a362746342099578257b2eea..3ce85530b718666afa1dafbf60699c1add423ea6 100644
1212
--- a/llvm/include/llvm/ADT/FunctionExtras.h
1313
+++ b/llvm/include/llvm/ADT/FunctionExtras.h
1414
@@ -79,7 +79,7 @@ using EnableIfCallable = std::enable_if_t<std::disjunction<
@@ -28,4 +28,4 @@ index c0bc30c7450fe4b2bc6b9b448824eedc8b132e52..5641a913d0a35ee2911cf872ad90c3dc
2828
+ // provide four pointers worth of storage here.
2929
// This is mutable as an inlined `const unique_function<void() const>` may
3030
// still modify its own mutable members.
31-
mutable std::aligned_storage_t<InlineStorageSize, alignof(void *)>
31+
alignas(void *) mutable std::byte InlineStorage[InlineStorageSize];

upstream_utils/llvm_patches/0004-Threading-updates.patch

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: PJ Reiniger <[email protected]>
33
Date: Sat, 7 May 2022 22:17:19 -0400
4-
Subject: [PATCH 04/36] Threading updates
4+
Subject: [PATCH 04/37] Threading updates
55

66
- Remove guards for threads and exception
77
- Prefer scope gaurd over lock gaurd
@@ -12,18 +12,18 @@ Subject: [PATCH 04/36] Threading updates
1212
3 files changed, 11 insertions(+), 43 deletions(-)
1313

1414
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
15-
index 6789f0413d8dc94cb465b6e66506b036449ee186..e608f8ea3a837a04d9c29c8bb7a1fab527d512bb 100644
15+
index 7710bd9a08148289b5ba3b1f2dae5cccc4f26d4d..2a6accec1e74c9869d724c7733cc75ab6af9dc8d 100644
1616
--- a/llvm/include/llvm/Support/Compiler.h
1717
+++ b/llvm/include/llvm/Support/Compiler.h
18-
@@ -555,7 +555,6 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
18+
@@ -563,7 +563,6 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
1919
/// initialize to some constant value. In almost all circumstances this is most
2020
/// appropriate for use with a pointer, integer, or small aggregation of
2121
/// pointers and integers.
2222
-#if LLVM_ENABLE_THREADS
2323
#if __has_feature(cxx_thread_local) || defined(_MSC_VER)
2424
#define LLVM_THREAD_LOCAL thread_local
2525
#else
26-
@@ -563,11 +562,6 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
26+
@@ -571,11 +570,6 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
2727
// we only need the restricted functionality that provides.
2828
#define LLVM_THREAD_LOCAL __thread
2929
#endif
@@ -36,7 +36,7 @@ index 6789f0413d8dc94cb465b6e66506b036449ee186..e608f8ea3a837a04d9c29c8bb7a1fab5
3636
/// \macro LLVM_ENABLE_EXCEPTIONS
3737
/// Whether LLVM is built with exception support.
3838
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
39-
index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb8ba1276e 100644
39+
index 561509e0efdf15f6e534f0621a5964d92511114c..89829dc4faff0b2667ded462444e0eaeec53fd01 100644
4040
--- a/llvm/lib/Support/ErrorHandling.cpp
4141
+++ b/llvm/lib/Support/ErrorHandling.cpp
4242
@@ -44,7 +44,6 @@ static void *ErrorHandlerUserData = nullptr;
@@ -83,17 +83,18 @@ index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb
8383
handler = ErrorHandler;
8484
handlerData = ErrorHandlerUserData;
8585
}
86-
@@ -126,18 +118,14 @@ void llvm::report_fatal_error(std::string_view Reason, bool GenCrashDiag) {
86+
@@ -126,9 +118,7 @@ void llvm::report_fatal_error(std::string_view Reason, bool GenCrashDiag) {
8787

8888
void llvm::install_bad_alloc_error_handler(fatal_error_handler_t handler,
8989
void *user_data) {
9090
-#if LLVM_ENABLE_THREADS == 1
9191
- std::lock_guard<std::mutex> Lock(BadAllocErrorHandlerMutex);
9292
-#endif
9393
+ std::scoped_lock Lock(BadAllocErrorHandlerMutex);
94-
assert(!ErrorHandler && "Bad alloc error handler already registered!\n");
94+
assert(!BadAllocErrorHandler &&
95+
"Bad alloc error handler already registered!\n");
9596
BadAllocErrorHandler = handler;
96-
BadAllocErrorHandlerUserData = user_data;
97+
@@ -136,9 +126,7 @@ void llvm::install_bad_alloc_error_handler(fatal_error_handler_t handler,
9798
}
9899

99100
void llvm::remove_bad_alloc_error_handler() {
@@ -104,7 +105,7 @@ index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb
104105
BadAllocErrorHandler = nullptr;
105106
BadAllocErrorHandlerUserData = nullptr;
106107
}
107-
@@ -148,9 +136,7 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
108+
@@ -149,9 +137,7 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
108109
{
109110
// Only acquire the mutex while reading the handler, so as not to invoke a
110111
// user-supplied callback under a lock.
@@ -115,7 +116,7 @@ index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb
115116
Handler = BadAllocErrorHandler;
116117
HandlerData = BadAllocErrorHandlerUserData;
117118
}
118-
@@ -160,10 +146,6 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
119+
@@ -161,10 +147,6 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
119120
llvm_unreachable("bad alloc handler should not return");
120121
}
121122

@@ -126,7 +127,7 @@ index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb
126127
// Don't call the normal error handler. It may allocate memory. Directly write
127128
// an OOM to stderr and abort.
128129
const char *OOMMessage = "LLVM ERROR: out of memory\n";
129-
@@ -172,15 +154,8 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
130+
@@ -173,15 +155,8 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
130131
(void)!::write(2, Reason, strlen(Reason));
131132
(void)!::write(2, Newline, strlen(Newline));
132133
abort();
@@ -142,7 +143,7 @@ index 0aa13a0f78eb370b2a673ca4a773f26820575052..637b669a7d0dae69ef4b34955f21a9fb
142143
// Causes crash on allocation failure. It is called prior to the handler set by
143144
// 'install_bad_alloc_error_handler'.
144145
static void out_of_memory_new_handler() {
145-
@@ -195,7 +170,6 @@ void llvm::install_out_of_memory_new_handler() {
146+
@@ -196,7 +171,6 @@ void llvm::install_out_of_memory_new_handler() {
146147
assert((old == nullptr || old == out_of_memory_new_handler) &&
147148
"new-handler already installed");
148149
}

0 commit comments

Comments
 (0)