Skip to content

Commit 15eb5af

Browse files
Merge branch 'main' into users/yuxuanchen1997/coro-fix-cgscc-update
2 parents 3bbd280 + d3b9855 commit 15eb5af

File tree

71 files changed

+1129
-338
lines changed

Some content is hidden

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

71 files changed

+1129
-338
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,15 @@ static bool interp__builtin_operator_delete(InterpState &S, CodePtr OpPC,
16701670
S, OpPC, *AllocForm, DynamicAllocator::Form::Operator, BlockDesc, Source);
16711671
}
16721672

1673+
static bool interp__builtin_arithmetic_fence(InterpState &S, CodePtr OpPC,
1674+
const InterpFrame *Frame,
1675+
const Function *Func,
1676+
const CallExpr *Call) {
1677+
const Floating &Arg0 = S.Stk.peek<Floating>();
1678+
S.Stk.push<Floating>(Arg0);
1679+
return true;
1680+
}
1681+
16731682
bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
16741683
const CallExpr *Call, uint32_t BuiltinID) {
16751684
const InterpFrame *Frame = S.Current;
@@ -2111,6 +2120,11 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
21112120
return false;
21122121
break;
21132122

2123+
case Builtin::BI__arithmetic_fence:
2124+
if (!interp__builtin_arithmetic_fence(S, OpPC, Frame, F, Call))
2125+
return false;
2126+
break;
2127+
21142128
default:
21152129
S.FFDiag(S.Current->getLocation(OpPC),
21162130
diag::note_invalid_subexpr_in_const_expr)

clang/test/Sema/arithmetic-fence-builtin.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - -verify -x c++ %s
2+
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
23
// RUN: %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -verify -x c++ %s
4+
// RUN: %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
35
// RUN: not %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -x c++ %s \
46
// RUN: -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
7+
// RUN: not %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -x c++ %s -fexperimental-new-constant-interpreter \
8+
// RUN: -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
59
// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s
10+
// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
611
#ifndef PPC
712
int v;
813
template <typename T> T addT(T a, T b) {

compiler-rt/lib/asan/scripts/asan_symbolize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def symbolize(self, addr, binary, offset):
316316
# * For C functions atos omits parentheses and argument types.
317317
# * For C++ functions the function name (i.e., `foo` above) may contain
318318
# templates which may contain parentheses.
319-
match = re.match("^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
319+
match = re.match(r"^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
320320
logging.debug("atos_line: %s", atos_line)
321321
if match:
322322
function_name = match.group(1)
@@ -541,7 +541,7 @@ def process_line_posix(self, line):
541541
# names in the regex because it could be an
542542
# Objective-C or C++ demangled name.
543543
stack_trace_line_format = (
544-
"^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
544+
r"^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
545545
)
546546
match = re.match(stack_trace_line_format, line)
547547
if not match:

compiler-rt/lib/hwasan/scripts/hwasan_symbolize

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class Symbolizer:
316316
self.__last_access_tag = int(match.group(2), 16)
317317

318318
def process_tag_dump_line(self, line, ignore_tags=False):
319-
m = re.match(r'.*?(0x[0-9a-f]+):' + '([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
319+
m = re.match(r'.*?(0x[0-9a-f]+):' + r'([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
320320
if m is None:
321321
return False
322322
addr = m.group(1)

compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,13 @@ TEST(TestRtsanInterceptors, VallocDiesWhenRealtime) {
122122
ExpectNonRealtimeSurvival(Func);
123123
}
124124

125-
#if __has_builtin(__builtin_available) && SANITIZER_APPLE
126-
#define ALIGNED_ALLOC_AVAILABLE() (__builtin_available(macOS 10.15, *))
127-
#else
128-
// We are going to assume this is true until we hit systems where it isn't
129-
#define ALIGNED_ALLOC_AVAILABLE() (true)
130-
#endif
131-
125+
#if SANITIZER_INTERCEPT_ALIGNED_ALLOC
132126
TEST(TestRtsanInterceptors, AlignedAllocDiesWhenRealtime) {
133-
if (ALIGNED_ALLOC_AVAILABLE()) {
134-
auto Func = []() { EXPECT_NE(nullptr, aligned_alloc(16, 32)); };
135-
ExpectRealtimeDeath(Func, "aligned_alloc");
136-
ExpectNonRealtimeSurvival(Func);
137-
}
127+
auto Func = []() { EXPECT_NE(nullptr, aligned_alloc(16, 32)); };
128+
ExpectRealtimeDeath(Func, "aligned_alloc");
129+
ExpectNonRealtimeSurvival(Func);
138130
}
131+
#endif
139132

140133
// free_sized and free_aligned_sized (both C23) are not yet supported
141134
TEST(TestRtsanInterceptors, FreeDiesWhenRealtime) {

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,6 @@
8484
#define SI_NOT_MAC 1
8585
#endif
8686

87-
#if SANITIZER_APPLE
88-
# include <Availability.h>
89-
90-
// aligned_alloc was introduced in OSX 10.15
91-
// Linking will fail when using an older SDK
92-
# if defined(__MAC_10_15)
93-
// macOS 10.15 is greater than our minimal deployment target. To ensure we
94-
// generate a weak reference so the dylib continues to work on older
95-
// systems, we need to forward declare the intercepted function as "weak
96-
// imports".
97-
SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
98-
__sanitizer::usize __size);
99-
# define SI_MAC_SDK_10_15_AVAILABLE 1
100-
# else
101-
# define SI_MAC_SDK_10_15_AVAILABLE 0
102-
# endif // defined(__MAC_10_15)
103-
104-
#endif // SANITIZER_APPLE
105-
10687
#if SANITIZER_IOS
10788
#define SI_IOS 1
10889
#else
@@ -519,8 +500,7 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
519500
#define SANITIZER_INTERCEPT_PVALLOC (SI_GLIBC || SI_ANDROID)
520501
#define SANITIZER_INTERCEPT_CFREE (SI_GLIBC && !SANITIZER_RISCV64)
521502
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
522-
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC \
523-
(!SI_MAC || SI_MAC_SDK_10_15_AVAILABLE)
503+
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC)
524504
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
525505
#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
526506
#define SANITIZER_INTERCEPT_WCSLEN 1

libcxx/include/__vector/vector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@ class _LIBCPP_TEMPLATE_VIS vector {
165165
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
166166
vector(size_type __n, const value_type& __x, const allocator_type& __a)
167167
: __alloc_(__a) {
168+
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
168169
if (__n > 0) {
169170
__vallocate(__n);
170171
__construct_at_end(__n, __x);
171172
}
173+
__guard.__complete();
172174
}
173175

174176
template <class _InputIterator,

libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ int main(int, char**) {
139139
check_new_delete_called();
140140
#endif // TEST_STD_VER >= 14
141141

142+
try { // Throw in vector(size_type, value_type, const allocator_type&) from the type
143+
int throw_after = 1;
144+
ThrowingT v(throw_after);
145+
std::vector<ThrowingT> vec(1, v, std::allocator<ThrowingT>());
146+
} catch (int) {
147+
}
148+
check_new_delete_called();
149+
142150
try { // Throw in vector(InputIterator, InputIterator) from input iterator
143151
std::vector<int> vec((Iterator<std::input_iterator_tag>()), Iterator<std::input_iterator_tag>(2));
144152
} catch (int) {

lld/ELF/Symbols.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Symbol {
7575

7676
// The default copy constructor is deleted due to atomic flags. Define one for
7777
// places where no atomic is needed.
78-
Symbol(const Symbol &o) { memcpy(this, &o, sizeof(o)); }
78+
Symbol(const Symbol &o) { memcpy(static_cast<void *>(this), &o, sizeof(o)); }
7979

8080
protected:
8181
const char *nameData;

llvm/include/llvm/ADT/GenericCycleImpl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ bool GenericCycle<ContextT>::contains(const GenericCycle *C) const {
4747
template <typename ContextT>
4848
void GenericCycle<ContextT>::getExitBlocks(
4949
SmallVectorImpl<BlockT *> &TmpStorage) const {
50+
if (!ExitBlocksCache.empty()) {
51+
TmpStorage = ExitBlocksCache;
52+
return;
53+
}
54+
5055
TmpStorage.clear();
5156

5257
size_t NumExitBlocks = 0;
@@ -65,6 +70,7 @@ void GenericCycle<ContextT>::getExitBlocks(
6570

6671
TmpStorage.resize(NumExitBlocks);
6772
}
73+
ExitBlocksCache.append(TmpStorage.begin(), TmpStorage.end());
6874
}
6975

7076
template <typename ContextT>
@@ -298,6 +304,8 @@ void GenericCycleInfo<ContextT>::moveTopLevelCycleToNewParent(CycleT *NewParent,
298304
for (auto &It : BlockMapTopLevel)
299305
if (It.second == Child)
300306
It.second = NewParent;
307+
NewParent->clearCache();
308+
Child->clearCache();
301309
}
302310

303311
template <typename ContextT>
@@ -316,6 +324,7 @@ void GenericCycleInfo<ContextT>::addBlockToCycle(BlockT *Block, CycleT *Cycle) {
316324
}
317325

318326
BlockMapTopLevel.try_emplace(Block, Cycle);
327+
Cycle->clearCache();
319328
}
320329

321330
/// \brief Main function of the cycle info computations.

0 commit comments

Comments
 (0)