Skip to content

Commit f6a187e

Browse files
committed
Merge branch 'main' into buffer-load-all
2 parents c9bccd7 + 5c1752e commit f6a187e

File tree

112 files changed

+2393
-1776
lines changed

Some content is hidden

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

112 files changed

+2393
-1776
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22398,10 +22398,6 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2239822398
default: llvm_unreachable("unexpected builtin ID");
2239922399
case RISCV::BI__builtin_riscv_orc_b_32:
2240022400
case RISCV::BI__builtin_riscv_orc_b_64:
22401-
case RISCV::BI__builtin_riscv_clz_32:
22402-
case RISCV::BI__builtin_riscv_clz_64:
22403-
case RISCV::BI__builtin_riscv_ctz_32:
22404-
case RISCV::BI__builtin_riscv_ctz_64:
2240522401
case RISCV::BI__builtin_riscv_clmul_32:
2240622402
case RISCV::BI__builtin_riscv_clmul_64:
2240722403
case RISCV::BI__builtin_riscv_clmulh_32:
@@ -22423,24 +22419,6 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2242322419
case RISCV::BI__builtin_riscv_orc_b_64:
2242422420
ID = Intrinsic::riscv_orc_b;
2242522421
break;
22426-
case RISCV::BI__builtin_riscv_clz_32:
22427-
case RISCV::BI__builtin_riscv_clz_64: {
22428-
Function *F = CGM.getIntrinsic(Intrinsic::ctlz, Ops[0]->getType());
22429-
Value *Result = Builder.CreateCall(F, {Ops[0], Builder.getInt1(false)});
22430-
if (Result->getType() != ResultType)
22431-
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
22432-
"cast");
22433-
return Result;
22434-
}
22435-
case RISCV::BI__builtin_riscv_ctz_32:
22436-
case RISCV::BI__builtin_riscv_ctz_64: {
22437-
Function *F = CGM.getIntrinsic(Intrinsic::cttz, Ops[0]->getType());
22438-
Value *Result = Builder.CreateCall(F, {Ops[0], Builder.getInt1(false)});
22439-
if (Result->getType() != ResultType)
22440-
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
22441-
"cast");
22442-
return Result;
22443-
}
2244422422

2244522423
// Zbc
2244622424
case RISCV::BI__builtin_riscv_clmul_32:
@@ -22515,6 +22493,25 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2251522493
ID = Intrinsic::riscv_sm3p1;
2251622494
break;
2251722495

22496+
case RISCV::BI__builtin_riscv_clz_32:
22497+
case RISCV::BI__builtin_riscv_clz_64: {
22498+
Function *F = CGM.getIntrinsic(Intrinsic::ctlz, Ops[0]->getType());
22499+
Value *Result = Builder.CreateCall(F, {Ops[0], Builder.getInt1(false)});
22500+
if (Result->getType() != ResultType)
22501+
Result =
22502+
Builder.CreateIntCast(Result, ResultType, /*isSigned*/ false, "cast");
22503+
return Result;
22504+
}
22505+
case RISCV::BI__builtin_riscv_ctz_32:
22506+
case RISCV::BI__builtin_riscv_ctz_64: {
22507+
Function *F = CGM.getIntrinsic(Intrinsic::cttz, Ops[0]->getType());
22508+
Value *Result = Builder.CreateCall(F, {Ops[0], Builder.getInt1(false)});
22509+
if (Result->getType() != ResultType)
22510+
Result =
22511+
Builder.CreateIntCast(Result, ResultType, /*isSigned*/ false, "cast");
22512+
return Result;
22513+
}
22514+
2251822515
// Zihintntl
2251922516
case RISCV::BI__builtin_riscv_ntl_load: {
2252022517
llvm::Type *ResTy = ConvertType(E->getType());

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,33 +164,45 @@ void SetSigProcMask(__sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset) {
164164
CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, set, oldset));
165165
}
166166

167+
// Deletes the specified signal from newset, if it is not present in oldset
168+
// Equivalently: newset[signum] = newset[signum] & oldset[signum]
169+
static void KeepUnblocked(__sanitizer_sigset_t &newset,
170+
__sanitizer_sigset_t &oldset, int signum) {
171+
if (!internal_sigismember(&oldset, signum))
172+
internal_sigdelset(&newset, signum);
173+
}
174+
167175
// Block asynchronous signals
168176
void BlockSignals(__sanitizer_sigset_t *oldset) {
169-
__sanitizer_sigset_t set;
170-
internal_sigfillset(&set);
177+
__sanitizer_sigset_t currentset;
178+
SetSigProcMask(NULL, &currentset);
179+
180+
__sanitizer_sigset_t newset;
181+
internal_sigfillset(&newset);
171182
# if SANITIZER_LINUX && !SANITIZER_ANDROID
172183
// Glibc uses SIGSETXID signal during setuid call. If this signal is blocked
173184
// on any thread, setuid call hangs.
174185
// See test/sanitizer_common/TestCases/Linux/setuid.c.
175-
internal_sigdelset(&set, 33);
186+
KeepUnblocked(newset, currentset, 33);
176187
# endif
177188
# if SANITIZER_LINUX
178189
// Seccomp-BPF-sandboxed processes rely on SIGSYS to handle trapped syscalls.
179190
// If this signal is blocked, such calls cannot be handled and the process may
180191
// hang.
181-
internal_sigdelset(&set, 31);
192+
KeepUnblocked(newset, currentset, 31);
182193

183194
// Don't block synchronous signals
184-
internal_sigdelset(&set, SIGSEGV);
185-
internal_sigdelset(&set, SIGBUS);
186-
internal_sigdelset(&set, SIGILL);
187-
internal_sigdelset(&set, SIGTRAP);
188-
internal_sigdelset(&set, SIGABRT);
189-
internal_sigdelset(&set, SIGFPE);
190-
internal_sigdelset(&set, SIGPIPE);
195+
// but also don't unblock signals that the user had deliberately blocked.
196+
KeepUnblocked(newset, currentset, SIGSEGV);
197+
KeepUnblocked(newset, currentset, SIGBUS);
198+
KeepUnblocked(newset, currentset, SIGILL);
199+
KeepUnblocked(newset, currentset, SIGTRAP);
200+
KeepUnblocked(newset, currentset, SIGABRT);
201+
KeepUnblocked(newset, currentset, SIGFPE);
202+
KeepUnblocked(newset, currentset, SIGPIPE);
191203
# endif
192204

193-
SetSigProcMask(&set, oldset);
205+
SetSigProcMask(&newset, oldset);
194206
}
195207

196208
ScopedBlockSignals::ScopedBlockSignals(__sanitizer_sigset_t *copy) {

compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(SANITIZER_UNITTESTS
1515
sanitizer_array_ref_test.cpp
1616
sanitizer_atomic_test.cpp
1717
sanitizer_bitvector_test.cpp
18+
sanitizer_block_signals.cpp
1819
sanitizer_bvgraph_test.cpp
1920
sanitizer_chained_origin_depot_test.cpp
2021
sanitizer_common_test.cpp
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
//===-- sanitizer_block_signals.cpp ---------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file is a part of sanitizer_common unit tests.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
#include <signal.h>
13+
#include <stdio.h>
14+
15+
#include "gtest/gtest.h"
16+
#include "sanitizer_common/sanitizer_linux.h"
17+
18+
namespace __sanitizer {
19+
20+
#if SANITIZER_LINUX
21+
volatile int received_sig = -1;
22+
23+
void signal_handler(int signum) { received_sig = signum; }
24+
25+
TEST(SanitizerCommon, NoBlockSignals) {
26+
// No signals blocked
27+
signal(SIGUSR1, signal_handler);
28+
raise(SIGUSR1);
29+
EXPECT_EQ(received_sig, SIGUSR1);
30+
31+
received_sig = -1;
32+
signal(SIGPIPE, signal_handler);
33+
raise(SIGPIPE);
34+
EXPECT_EQ(received_sig, SIGPIPE);
35+
}
36+
37+
TEST(SanitizerCommon, BlockSignalsPlain) {
38+
// ScopedBlockSignals; SIGUSR1 should be blocked but not SIGPIPE
39+
{
40+
__sanitizer_sigset_t sigset = {};
41+
ScopedBlockSignals block(&sigset);
42+
43+
received_sig = -1;
44+
signal(SIGUSR1, signal_handler);
45+
raise(SIGUSR1);
46+
EXPECT_EQ(received_sig, -1);
47+
48+
received_sig = -1;
49+
signal(SIGPIPE, signal_handler);
50+
raise(SIGPIPE);
51+
EXPECT_EQ(received_sig, SIGPIPE);
52+
}
53+
EXPECT_EQ(received_sig, SIGUSR1);
54+
}
55+
56+
TEST(SanitizerCommon, BlockSignalsExceptPipe) {
57+
// Manually block SIGPIPE; ScopedBlockSignals should not unblock this
58+
sigset_t block_sigset;
59+
sigemptyset(&block_sigset);
60+
sigaddset(&block_sigset, SIGPIPE);
61+
sigprocmask(SIG_BLOCK, &block_sigset, NULL);
62+
{
63+
__sanitizer_sigset_t sigset = {};
64+
ScopedBlockSignals block(&sigset);
65+
66+
received_sig = -1;
67+
signal(SIGPIPE, signal_handler);
68+
raise(SIGPIPE);
69+
EXPECT_EQ(received_sig, -1);
70+
}
71+
sigprocmask(SIG_UNBLOCK, &block_sigset, NULL);
72+
EXPECT_EQ(received_sig, SIGPIPE);
73+
}
74+
#endif // SANITIZER_LINUX
75+
76+
} // namespace __sanitizer

flang/test/Fir/tco-default-datalayout.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ module {
77
// CHECK: module attributes {
88
// CHECK-SAME: dlti.dl_spec = #dlti.dl_spec<
99
// ...
10-
// CHECK-SAME: #dlti.dl_entry<i64, dense<[32, 64]> : vector<2xi64>>,
10+
// CHECK-SAME: i64 = dense<[32, 64]> : vector<2xi64>,
1111
// ...
1212
// CHECK-SAME: llvm.data_layout = ""

flang/test/Fir/tco-explicit-datalayout.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ module attributes {llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i6
88
// CHECK: module attributes {
99
// CHECK-SAME: dlti.dl_spec = #dlti.dl_spec<
1010
// ...
11-
// CHECK-SAME: #dlti.dl_entry<i64, dense<128> : vector<2xi64>>,
11+
// CHECK-SAME: i64 = dense<128> : vector<2xi64>,
1212
// ...
1313
// CHECK-SAME: llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:128-i128:128-f80:128-n8:16:32:64-S128"

lldb/test/API/lit.cfg.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,6 @@ def delete_module_cache(path):
268268
if is_configured("lldb_framework_dir"):
269269
dotest_cmd += ["--framework", config.lldb_framework_dir]
270270

271-
if (
272-
"lldb-repro-capture" in config.available_features
273-
or "lldb-repro-replay" in config.available_features
274-
):
275-
dotest_cmd += ["--skip-category=lldb-dap", "--skip-category=std-module"]
276-
277271
if "lldb-simulator-ios" in config.available_features:
278272
dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", "ios-simulator"]
279273
elif "lldb-simulator-watchos" in config.available_features:

lldb/test/Shell/Driver/LocalLLDBInit.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# REQUIRES: python
2-
# UNSUPPORTED: lldb-repro
32
#
43
# RUN: mkdir -p %t.root
54
# RUN: mkdir -p %t.home
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# UNSUPPORTED: lldb-repro
2-
#
31
# RUN: not %lldb -c /bogus/path 2>&1 | FileCheck %s
42
# CHECK: error: file specified in --core (-c) option doesn't exist
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
UNSUPPORTED: lldb-repro
21
RUN: not %lldb --arch 2>&1 | FileCheck %s
32
CHECK: error: argument to '--arch' is missing

0 commit comments

Comments
 (0)