Skip to content

Commit add2053

Browse files
Reland "[llvm-exegesis] Fix preservation of RDI in subprocess mode (#72458)"
This reverts commit 186db1b. This relands commit 0718c1a. The REQUIRES flag in the test that was added only specified that the machine needed to have the capability to execute the snippet rather than actually run it with performance counters. This would work with --dummy-perf-counters, but that is not currently supported in the subprocess execution mode. So for now, we require the ability to actually perform measurements to prevent test failures in configurations that don't have libpfm or access to performance counters.
1 parent 5f64b94 commit add2053

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# REQUIRES: exegesis-can-measure-latency, x86_64-linux
2+
3+
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mode=latency -snippets-file=%s -execution-mode=subprocess | FileCheck %s
4+
5+
# See comment in ./subprocess-abnormal-exit-code.s on the transient
6+
# PTRACE_ATTACH failure.
7+
# ALLOW_RETRIES: 2
8+
9+
# Check that the value of the registers preserved in subprocess mode while
10+
# making the ioctl system call are actually preserved correctly.
11+
12+
# LLVM-EXEGESIS-DEFREG RAX 11
13+
# LLVM-EXEGESIS-DEFREG RDI 13
14+
# LLVM-EXEGESIS-DEFREG RSI 17
15+
# LLVM-EXEGESIS-DEFREG R13 0
16+
# LLVM-EXEGESIS-DEFREG R12 127
17+
18+
cmpq $0x11, %rax
19+
cmovneq %r12, %r13
20+
cmpq $0x13, %rdi
21+
cmovneq %r12, %r13
22+
cmpq $0x17, %rsi
23+
cmovneq %r12, %r13
24+
25+
movq $60, %rax
26+
movq %r13, %rdi
27+
syscall
28+
29+
# CHECK-NOT: error: 'Child benchmarking process exited with non-zero exit code: Child process returned with unknown exit code'
30+

llvm/tools/llvm-exegesis/lib/X86/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ ExegesisX86Target::configurePerfCounter(long Request, bool SaveRegisters) const
12051205
if(SaveRegisters) {
12061206
// Restore RAX, RDI, and RSI, in reverse order.
12071207
generateRegisterStackPop(X86::RSI, ConfigurePerfCounterCode);
1208-
generateRegisterStackPop(X86::RIP, ConfigurePerfCounterCode);
1208+
generateRegisterStackPop(X86::RDI, ConfigurePerfCounterCode);
12091209
generateRegisterStackPop(X86::RAX, ConfigurePerfCounterCode);
12101210
}
12111211
return ConfigurePerfCounterCode;

0 commit comments

Comments
 (0)