Skip to content

Commit 2af0037

Browse files
authored
Merge branch 'main' into remove-tosa-mul-commutative
2 parents f01ce2e + 27d8441 commit 2af0037

File tree

8 files changed

+79
-168
lines changed

8 files changed

+79
-168
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,6 @@ void ReportDeadlySignal(const SignalContext &sig, u32 tid,
390390
void SetAlternateSignalStack();
391391
void UnsetAlternateSignalStack();
392392

393-
bool IsSignalHandlerFromSanitizer(int signum);
394-
bool SetSignalHandlerFromSanitizer(int signum, bool new_state);
395-
396393
// Construct a one-line string:
397394
// SUMMARY: SanitizerToolName: error_message
398395
// and pass it to __sanitizer_report_error_summary.

compiler-rt/lib/sanitizer_common/sanitizer_flags.inc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ COMMON_FLAG(HandleSignalMode, handle_sigfpe, kHandleSignalYes,
113113
COMMON_FLAG(bool, allow_user_segv_handler, true,
114114
"Deprecated. True has no effect, use handle_sigbus=1. If false, "
115115
"handle_*=1 will be upgraded to handle_*=2.")
116-
COMMON_FLAG(bool, cloak_sanitizer_signal_handlers, false,
117-
"If set, signal/sigaction will pretend that sanitizers did not "
118-
"preinstall any signal handlers. If the user subsequently installs "
119-
"a signal handler, this will disable cloaking for the respective "
120-
"signal.")
121116
COMMON_FLAG(bool, use_sigaltstack, true,
122117
"If set, uses alternate stack for signal handling.")
123118
COMMON_FLAG(bool, detect_deadlocks, true,

compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
4747

4848
namespace __sanitizer {
4949

50-
static atomic_uint8_t signal_handler_is_from_sanitizer[64];
51-
5250
u32 GetUid() {
5351
return getuid();
5452
}
@@ -212,20 +210,6 @@ void UnsetAlternateSignalStack() {
212210
UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
213211
}
214212

215-
bool IsSignalHandlerFromSanitizer(int signum) {
216-
return atomic_load(&signal_handler_is_from_sanitizer[signum],
217-
memory_order_relaxed);
218-
}
219-
220-
bool SetSignalHandlerFromSanitizer(int signum, bool new_state) {
221-
if (signum < 0 || static_cast<unsigned>(signum) >=
222-
ARRAY_SIZE(signal_handler_is_from_sanitizer))
223-
return false;
224-
225-
return atomic_exchange(&signal_handler_is_from_sanitizer[signum], new_state,
226-
memory_order_relaxed);
227-
}
228-
229213
static void MaybeInstallSigaction(int signum,
230214
SignalHandlerType handler) {
231215
if (GetHandleSignalMode(signum) == kHandleSignalNo) return;
@@ -239,9 +223,6 @@ static void MaybeInstallSigaction(int signum,
239223
if (common_flags()->use_sigaltstack) sigact.sa_flags |= SA_ONSTACK;
240224
CHECK_EQ(0, internal_sigaction(signum, &sigact, nullptr));
241225
VReport(1, "Installed the sigaction for signal %d\n", signum);
242-
243-
if (common_flags()->cloak_sanitizer_signal_handlers)
244-
SetSignalHandlerFromSanitizer(signum, true);
245226
}
246227

247228
void InstallDeadlySignalHandlers(SignalHandlerType handler) {

compiler-rt/lib/sanitizer_common/sanitizer_signal_interceptors.inc

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ using namespace __sanitizer;
4545
INTERCEPTOR(uptr, bsd_signal, int signum, uptr handler) {
4646
SIGNAL_INTERCEPTOR_ENTER();
4747
if (GetHandleSignalMode(signum) == kHandleSignalExclusive) return 0;
48-
49-
// TODO: support cloak_sanitizer_signal_handlers
5048
SIGNAL_INTERCEPTOR_SIGNAL_IMPL(bsd_signal, signum, handler);
5149
}
5250
#define INIT_BSD_SIGNAL COMMON_INTERCEPT_FUNCTION(bsd_signal)
@@ -58,55 +56,19 @@ INTERCEPTOR(uptr, bsd_signal, int signum, uptr handler) {
5856
INTERCEPTOR(uptr, signal, int signum, uptr handler) {
5957
SIGNAL_INTERCEPTOR_ENTER();
6058
if (GetHandleSignalMode(signum) == kHandleSignalExclusive)
61-
// The user can neither view nor change the signal handler, regardless of
62-
// the cloak_sanitizer_signal_handlers setting. This differs from
63-
// sigaction().
6459
return (uptr) nullptr;
65-
66-
uptr ret = +[](auto signal, int signum, uptr handler) {
67-
SIGNAL_INTERCEPTOR_SIGNAL_IMPL(signal, signum, handler);
68-
}(signal, signum, handler);
69-
70-
if (ret != sig_err && SetSignalHandlerFromSanitizer(signum, false))
71-
// If the user sets a signal handler, it becomes uncloaked, even if they
72-
// reuse a sanitizer's signal handler.
73-
ret = sig_dfl;
74-
75-
return ret;
60+
SIGNAL_INTERCEPTOR_SIGNAL_IMPL(signal, signum, handler);
7661
}
7762
#define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
7863

7964
INTERCEPTOR(int, sigaction_symname, int signum,
8065
const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
8166
SIGNAL_INTERCEPTOR_ENTER();
82-
8367
if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
8468
if (!oldact) return 0;
8569
act = nullptr;
86-
// If cloak_sanitizer_signal_handlers=true, the user can neither view nor
87-
// change the signal handle.
88-
// If false, the user can view but not change the signal handler. This
89-
// differs from signal().
9070
}
91-
92-
int ret = +[](int signum, const __sanitizer_sigaction* act,
93-
__sanitizer_sigaction* oldact) {
94-
SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
95-
}(signum, act, oldact);
96-
97-
if (act) {
98-
if (ret == 0 && SetSignalHandlerFromSanitizer(signum, false)) {
99-
// If the user sets a signal handler, it becomes uncloaked, even if they
100-
// reuse a sanitizer's signal handler.
101-
102-
if (oldact)
103-
oldact->handler = reinterpret_cast<__sanitizer_sighandler_ptr>(sig_dfl);
104-
}
105-
} else if (ret == 0 && oldact && IsSignalHandlerFromSanitizer(signum)) {
106-
oldact->handler = reinterpret_cast<__sanitizer_sighandler_ptr>(sig_dfl);
107-
}
108-
109-
return ret;
71+
SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
11072
}
11173
#define INIT_SIGACTION COMMON_INTERCEPT_FUNCTION(sigaction_symname)
11274

compiler-rt/test/sanitizer_common/TestCases/Linux/allow_user_segv.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
// Flaky errors in debuggerd with "waitpid returned unexpected pid (0)" in logcat.
2424
// UNSUPPORTED: android && i386-target-arch
2525

26-
// Note: this test case is unusual because it retrieves the original
27-
// (ASan-installed) signal handler; thus, it is incompatible with the
28-
// cloak_sanitizer_signal_handlers runtime option.
29-
3026
#include <signal.h>
3127
#include <stdio.h>
3228
#include <stdlib.h>

compiler-rt/test/sanitizer_common/TestCases/Linux/cloak_sigaction.cpp

Lines changed: 0 additions & 51 deletions
This file was deleted.

compiler-rt/test/sanitizer_common/TestCases/Linux/cloak_signal.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

llvm/test/CodeGen/PowerPC/check-zero-vector.ll renamed to llvm/test/CodeGen/PowerPC/compare-vector-with-zero.ll

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,80 @@ declare i4 @llvm.ctpop.i4(i4) #1
9595
!6 = !{!"short", !7, i64 0}
9696
!7 = !{!"omnipotent char", !8, i64 0}
9797
!8 = !{!"Simple C/C++ TBAA"}
98+
99+
; Function to lockdown changes for floating point vector comparisons
100+
define range(i32 0, 5) i32 @cols_needed(ptr %colauths){
101+
; POWERPC_64LE-LABEL: cols_needed:
102+
; POWERPC_64LE: # %bb.0: # %entry
103+
; POWERPC_64LE-NEXT: lxv vs0, 0(r3)
104+
; POWERPC_64LE-NEXT: xxlxor vs1, vs1, vs1
105+
; POWERPC_64LE-NEXT: li r4, 4
106+
; POWERPC_64LE-NEXT: li r3, 0
107+
; POWERPC_64LE-NEXT: xvcmpeqsp vs0, vs0, vs1
108+
; POWERPC_64LE-NEXT: xxlnor v2, vs0, vs0
109+
; POWERPC_64LE-NEXT: vextuwrx r4, r4, v2
110+
; POWERPC_64LE-NEXT: vextuwrx r3, r3, v2
111+
; POWERPC_64LE-NEXT: rlwinm r4, r4, 1, 30, 30
112+
; POWERPC_64LE-NEXT: sub r3, r4, r3
113+
; POWERPC_64LE-NEXT: mfvsrwz r4, v2
114+
; POWERPC_64LE-NEXT: rlwinm r4, r4, 2, 29, 29
115+
; POWERPC_64LE-NEXT: or r3, r3, r4
116+
; POWERPC_64LE-NEXT: li r4, 12
117+
; POWERPC_64LE-NEXT: vextuwrx r4, r4, v2
118+
; POWERPC_64LE-NEXT: slwi r4, r4, 3
119+
; POWERPC_64LE-NEXT: or r3, r3, r4
120+
; POWERPC_64LE-NEXT: clrlwi r3, r3, 28
121+
; POWERPC_64LE-NEXT: stb r3, -1(r1)
122+
; POWERPC_64LE-NEXT: lbz r3, -1(r1)
123+
; POWERPC_64LE-NEXT: popcntd r3, r3
124+
; POWERPC_64LE-NEXT: blr
125+
;
126+
; POWERPC_64-LABEL: cols_needed:
127+
; POWERPC_64: # %bb.0: # %entry
128+
; POWERPC_64-NEXT: lxv vs0, 0(r3)
129+
; POWERPC_64-NEXT: xxlxor vs1, vs1, vs1
130+
; POWERPC_64-NEXT: li r4, 8
131+
; POWERPC_64-NEXT: xvcmpeqsp vs0, vs0, vs1
132+
; POWERPC_64-NEXT: xxlnor v2, vs0, vs0
133+
; POWERPC_64-NEXT: vextuwlx r4, r4, v2
134+
; POWERPC_64-NEXT: mfvsrwz r3, v2
135+
; POWERPC_64-NEXT: rlwinm r4, r4, 1, 30, 30
136+
; POWERPC_64-NEXT: rlwimi r4, r3, 2, 29, 29
137+
; POWERPC_64-NEXT: li r3, 0
138+
; POWERPC_64-NEXT: vextuwlx r3, r3, v2
139+
; POWERPC_64-NEXT: rlwimi r4, r3, 3, 0, 28
140+
; POWERPC_64-NEXT: li r3, 12
141+
; POWERPC_64-NEXT: vextuwlx r3, r3, v2
142+
; POWERPC_64-NEXT: sub r3, r4, r3
143+
; POWERPC_64-NEXT: clrlwi r3, r3, 28
144+
; POWERPC_64-NEXT: stb r3, -1(r1)
145+
; POWERPC_64-NEXT: lbz r3, -1(r1)
146+
; POWERPC_64-NEXT: popcntd r3, r3
147+
; POWERPC_64-NEXT: blr
148+
;
149+
; POWERPC_32-LABEL: cols_needed:
150+
; POWERPC_32: # %bb.0: # %entry
151+
; POWERPC_32-NEXT: lxv vs0, 0(r3)
152+
; POWERPC_32-NEXT: xxlxor vs1, vs1, vs1
153+
; POWERPC_32-NEXT: xvcmpeqsp vs0, vs0, vs1
154+
; POWERPC_32-NEXT: xxlnor vs0, vs0, vs0
155+
; POWERPC_32-NEXT: stxv vs0, -32(r1)
156+
; POWERPC_32-NEXT: lwz r3, -24(r1)
157+
; POWERPC_32-NEXT: lwz r4, -28(r1)
158+
; POWERPC_32-NEXT: rlwinm r3, r3, 1, 30, 30
159+
; POWERPC_32-NEXT: rlwimi r3, r4, 2, 29, 29
160+
; POWERPC_32-NEXT: lwz r4, -32(r1)
161+
; POWERPC_32-NEXT: rlwimi r3, r4, 3, 0, 28
162+
; POWERPC_32-NEXT: lwz r4, -20(r1)
163+
; POWERPC_32-NEXT: sub r3, r3, r4
164+
; POWERPC_32-NEXT: clrlwi r3, r3, 28
165+
; POWERPC_32-NEXT: popcntw r3, r3
166+
; POWERPC_32-NEXT: blr
167+
entry:
168+
%0 = load <4 x float>, ptr %colauths, align 4, !tbaa !5
169+
%1 = fcmp une <4 x float> %0, zeroinitializer
170+
%2 = bitcast <4 x i1> %1 to i4
171+
%3 = tail call range(i4 0, 5) i4 @llvm.ctpop.i4(i4 %2)
172+
%4 = zext nneg i4 %3 to i32
173+
ret i32 %4
174+
}

0 commit comments

Comments
 (0)