Skip to content

Commit cbce559

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I3aea3233e3339018c63aa26b97197ac982c45bb1
2 parents f825a82 + 332fda8 commit cbce559

File tree

416 files changed

+17368
-6744
lines changed

Some content is hidden

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

416 files changed

+17368
-6744
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ env:
4949
jobs:
5050
stage1:
5151
if: github.repository_owner == 'llvm'
52-
runs-on: libcxx-runners-8-set
52+
runs-on: libcxx-runners-set
53+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
5354
continue-on-error: false
5455
strategy:
5556
fail-fast: false
@@ -85,7 +86,8 @@ jobs:
8586
**/crash_diagnostics/*
8687
stage2:
8788
if: github.repository_owner == 'llvm'
88-
runs-on: libcxx-runners-8-set
89+
runs-on: libcxx-runners-set
90+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
8991
needs: [ stage1 ]
9092
continue-on-error: false
9193
strategy:
@@ -162,20 +164,21 @@ jobs:
162164
'benchmarks',
163165
'bootstrapping-build'
164166
]
165-
machine: [ 'libcxx-runners-8-set' ]
167+
machine: [ 'libcxx-runners-set' ]
166168
include:
167169
- config: 'generic-cxx26'
168-
machine: libcxx-runners-8-set
170+
machine: libcxx-runners-set
169171
- config: 'generic-asan'
170-
machine: libcxx-runners-8-set
172+
machine: libcxx-runners-set
171173
- config: 'generic-tsan'
172-
machine: libcxx-runners-8-set
174+
machine: libcxx-runners-set
173175
- config: 'generic-ubsan'
174-
machine: libcxx-runners-8-set
176+
machine: libcxx-runners-set
175177
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
176178
- config: 'generic-msan'
177-
machine: libcxx-runners-8-set
179+
machine: libcxx-runners-set
178180
runs-on: ${{ matrix.machine }}
181+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
179182
steps:
180183
- uses: actions/checkout@v4
181184
- name: ${{ matrix.config }}

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18668,6 +18668,12 @@ Value *EmitAMDGPUGridSize(CodeGenFunction &CGF, unsigned Index) {
1866818668
auto *GEP = CGF.Builder.CreateGEP(CGF.Int8Ty, DP, Offset);
1866918669
auto *LD = CGF.Builder.CreateLoad(
1867018670
Address(GEP, CGF.Int32Ty, CharUnits::fromQuantity(4)));
18671+
18672+
llvm::MDBuilder MDB(CGF.getLLVMContext());
18673+
18674+
// Known non-zero.
18675+
LD->setMetadata(llvm::LLVMContext::MD_range,
18676+
MDB.createRange(APInt(32, 1), APInt::getZero(32)));
1867118677
LD->setMetadata(llvm::LLVMContext::MD_invariant_load,
1867218678
llvm::MDNode::get(CGF.getLLVMContext(), {}));
1867318679
return LD;

clang/lib/Driver/XRayArgs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
5353
case llvm::Triple::mipsel:
5454
case llvm::Triple::mips64:
5555
case llvm::Triple::mips64el:
56+
case llvm::Triple::systemz:
5657
break;
5758
default:
5859
D.Diag(diag::err_drv_unsupported_opt_for_target)

clang/test/CodeGenOpenCL/builtins-amdgcn.cl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ void test_get_workgroup_size(int d, global int *out)
639639
// CHECK-LABEL: @test_get_grid_size(
640640
// CHECK: {{.*}}call align 4 dereferenceable(64){{.*}} ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
641641
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 %{{.+}}
642-
// CHECK: load i32, ptr addrspace(4) %{{.*}}, align 4, !invariant.load
642+
// CHECK: load i32, ptr addrspace(4) %{{.*}}, align 4, !range [[$GRID_RANGE:![0-9]+]], !invariant.load
643643
void test_get_grid_size(int d, global int *out)
644644
{
645645
switch (d) {
@@ -896,5 +896,6 @@ void test_set_fpenv(unsigned long env) {
896896
__builtin_amdgcn_set_fpenv(env);
897897
}
898898

899+
// CHECK-DAG: [[$GRID_RANGE]] = !{i32 1, i32 0}
899900
// CHECK-DAG: [[$WS_RANGE]] = !{i16 1, i16 1025}
900901
// CHECK-DAG: attributes #[[$NOUNWIND_READONLY]] = { convergent mustprogress nocallback nofree nounwind willreturn memory(none) }

clang/test/Driver/XRay/xray-mode-flags.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// RUN: | FileCheck --check-prefix=BASIC %s
55
// RUN: %clang -### --target=aarch64-linux-gnu -fxray-instrument %s 2>&1 \
66
// RUN: | FileCheck --check-prefixes=FDR,BASIC %s
7+
// RUN: %clang -### --target=s390x-linux-gnu -fxray-instrument -fxray-modes=xray-basic %s 2>&1 \
8+
// RUN: | FileCheck --check-prefix=BASIC %s
79
// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=all %s 2>&1 \
810
// RUN: | FileCheck --check-prefixes=FDR,BASIC %s
911
// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=xray-fdr,xray-basic %s 2>&1 \

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ if(APPLE)
102102
set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM64})
103103
else()
104104
set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64}
105-
powerpc64le ${HEXAGON} ${LOONGARCH64})
105+
powerpc64le ${HEXAGON} ${LOONGARCH64} ${S390X})
106106
endif()
107107
set(ALL_XRAY_DSO_SUPPORTED_ARCH ${X86_64})
108108
set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64})

compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ static morder to_morder(int mo) {
515515
// since we use __sync_ atomics for actual atomic operations,
516516
// we can safely ignore it as well. It also subtly affects semantics,
517517
// but we don't model the difference.
518-
return static_cast<morder>(mo & 0x7fff);
518+
morder res = static_cast<morder>(static_cast<u8>(mo));
519+
DCHECK_LE(res, mo_seq_cst);
520+
return res;
519521
}
520522

521523
# define ATOMIC_IMPL(func, mo, ...) \

compiler-rt/lib/xray/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ set(hexagon_SOURCES
9292
xray_trampoline_hexagon.S
9393
)
9494

95+
set(s390x_SOURCES
96+
xray_s390x.cpp
97+
xray_trampoline_s390x.S
98+
)
99+
# Enable vector instructions in the assembly file.
100+
set_source_files_properties(xray_trampoline_s390x.S PROPERTIES COMPILE_FLAGS -mvx)
101+
95102
set(XRAY_SOURCE_ARCHS
96103
arm
97104
armhf
@@ -102,6 +109,7 @@ set(XRAY_SOURCE_ARCHS
102109
mips64
103110
mips64el
104111
powerpc64le
112+
s390x
105113
x86_64
106114
)
107115

@@ -152,6 +160,7 @@ set(XRAY_ALL_SOURCE_FILES
152160
${mips64_SOURCES}
153161
${mips64el_SOURCES}
154162
${powerpc64le_SOURCES}
163+
${s390x_SOURCES}
155164
${XRAY_IMPL_HEADERS}
156165
)
157166
list(REMOVE_DUPLICATES XRAY_ALL_SOURCE_FILES)

compiler-rt/lib/xray/xray_interface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ static const int16_t cSledLength = 64;
5757
static const int16_t cSledLength = 8;
5858
#elif defined(__hexagon__)
5959
static const int16_t cSledLength = 20;
60+
#elif defined(__s390x__)
61+
static const int16_t cSledLength = 18;
6062
#else
6163
#error "Unsupported CPU Architecture"
6264
#endif /* CPU architecture */

compiler-rt/lib/xray/xray_interface_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ extern void __xray_FunctionTailExit();
2929
extern void __xray_ArgLoggerEntry();
3030
extern void __xray_CustomEvent();
3131
extern void __xray_TypedEvent();
32+
#if defined(__s390x__)
33+
extern void __xray_FunctionEntryVec();
34+
extern void __xray_FunctionExitVec();
35+
#endif
3236
}
3337

3438
extern "C" {

compiler-rt/lib/xray/xray_s390x.cpp

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//===-- xray_s390x.cpp ------------------------------------------*- C++ -*-===//
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 XRay, a dynamic runtime instrumentation system.
10+
//
11+
// Implementation of s390x routines.
12+
//
13+
//===----------------------------------------------------------------------===//
14+
#include "sanitizer_common/sanitizer_common.h"
15+
#include "xray_defs.h"
16+
#include "xray_interface_internal.h"
17+
#include <cassert>
18+
#include <cstring>
19+
20+
bool __xray::patchFunctionEntry(const bool Enable, uint32_t FuncId,
21+
const XRaySledEntry &Sled,
22+
void (*Trampoline)()) XRAY_NEVER_INSTRUMENT {
23+
uint32_t *Address = reinterpret_cast<uint32_t *>(Sled.address());
24+
if (Enable) {
25+
// The resulting code is:
26+
// stmg %r2, %r15, 16(%r15)
27+
// llilf %2, FuncID
28+
// brasl %r14, __xray_FunctionEntry@GOT
29+
// The FuncId and the stmg instruction must be written.
30+
31+
// Write FuncId into llilf.
32+
Address[2] = FuncId;
33+
// Write last part of stmg.
34+
reinterpret_cast<uint16_t *>(Address)[2] = 0x24;
35+
// Write first part of stmg.
36+
Address[0] = 0xeb2ff010;
37+
} else {
38+
// j +16 instructions.
39+
Address[0] = 0xa7f4000b;
40+
}
41+
return true;
42+
}
43+
44+
bool __xray::patchFunctionExit(const bool Enable, uint32_t FuncId,
45+
const XRaySledEntry &Sled)
46+
XRAY_NEVER_INSTRUMENT {
47+
uint32_t *Address = reinterpret_cast<uint32_t *>(Sled.address());
48+
if (Enable) {
49+
// The resulting code is:
50+
// stmg %r2, %r15, 24(%r15)
51+
// llilf %2,FuncID
52+
// j __xray_FunctionEntry@GOT
53+
// The FuncId and the stmg instruction must be written.
54+
55+
// Write FuncId into llilf.
56+
Address[2] = FuncId;
57+
// Write last part of of stmg.
58+
reinterpret_cast<uint16_t *>(Address)[2] = 0x24;
59+
// Write first part of stmg.
60+
Address[0] = 0xeb2ff010;
61+
} else {
62+
// br %14 instruction.
63+
reinterpret_cast<uint16_t *>(Address)[0] = 0x07fe;
64+
}
65+
return true;
66+
}
67+
68+
bool __xray::patchFunctionTailExit(const bool Enable, const uint32_t FuncId,
69+
const XRaySledEntry &Sled)
70+
XRAY_NEVER_INSTRUMENT {
71+
return patchFunctionExit(Enable, FuncId, Sled);
72+
}
73+
74+
bool __xray::patchCustomEvent(const bool Enable, const uint32_t FuncId,
75+
const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
76+
// TODO Implement.
77+
return false;
78+
}
79+
80+
bool __xray::patchTypedEvent(const bool Enable, const uint32_t FuncId,
81+
const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
82+
// TODO Implement.
83+
return false;
84+
}
85+
86+
extern "C" void __xray_ArgLoggerEntry() XRAY_NEVER_INSTRUMENT {
87+
// TODO this will have to be implemented in the trampoline assembly file.
88+
}

0 commit comments

Comments
 (0)