Skip to content

Commit 8c967c8

Browse files
Merge branch 'llvm:main' into cfi-show
2 parents 1a11ef9 + 8989ec5 commit 8c967c8

File tree

561 files changed

+16446
-7762
lines changed

Some content is hidden

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

561 files changed

+16446
-7762
lines changed

bolt/test/runtime/copy_file.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
import shutil
3+
4+
with open(sys.argv[1] + ".output") as log_file:
5+
lines = log_file.readlines()
6+
for line in lines:
7+
if line.startswith(sys.argv[2]):
8+
pid = line.split(" ")[1].strip()
9+
shutil.copy(
10+
sys.argv[1] + "." + pid + ".fdata",
11+
sys.argv[1] + "." + sys.argv[3] + ".fdata",
12+
)
13+
sys.exit(0)
14+
15+
sys.exit(1)

bolt/test/runtime/instrumentation-indirect-2.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main() {
5050
return 0;
5151
}
5252
/*
53-
REQUIRES: system-linux,shell,fuser
53+
REQUIRES: system-linux,fuser
5454
5555
RUN: %clang %cflags %s -o %t.exe -Wl,-q -pie -fpie
5656
@@ -61,10 +61,14 @@ RUN: --instrumentation-wait-forks
6161
6262
# Instrumented program needs to finish returning zero
6363
# Both output and profile must contain all 16 functions
64-
RUN: %t.instrumented_conservative > %t.output
65-
# Wait for profile and output to be fully written
66-
RUN: bash %S/wait_file.sh %t.output
67-
RUN: bash %S/wait_file.sh %t.fdata
64+
# We need to use bash to invoke this as otherwise we hang inside a
65+
# popen.communicate call in lit's internal shell. Eventually we should not
66+
# need this.
67+
# TODO(boomanaiden154): Remove once
68+
# https://github.com/llvm/llvm-project/issues/156484 is fixed.
69+
RUN: bash -c "%t.instrumented_conservative; wait" > %t.output
70+
# We can just read because we ensure the profile will be fully written by
71+
# calling wait inside the bash invocation.
6872
RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-OUTPUT
6973
RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-COMMON-PROF
7074
@@ -112,14 +116,8 @@ RUN: bash %S/wait_file.sh %t.output
112116
# Make sure all functions were called
113117
RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-OUTPUT
114118
115-
RUN: child_pid=$(cat %t.output | grep funcA | awk '{print $2;}')
116-
RUN: par_pid=$(cat %t.output | grep funcB | awk '{print $2;}')
117-
118-
RUN: bash %S/wait_file.sh %t.$child_pid.fdata
119-
RUN: bash %S/wait_file.sh %t.$par_pid.fdata
120-
121-
RUN: mv %t.$child_pid.fdata %t.child.fdata
122-
RUN: mv %t.$par_pid.fdata %t.parent.fdata
119+
RUN: %python %S/copy_file.py %t funcA child
120+
RUN: %python %S/copy_file.py %t funcB parent
123121
124122
# Instrumented binary must produce two profiles with only local calls
125123
# recorded. Functions called only in child should not appear in parent's

clang/docs/analyzer/checkers.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,18 +2932,6 @@ the locking/unlocking of ``mtx_t`` mutexes.
29322932
mtx_lock(&mtx1); // warn: This lock has already been acquired
29332933
}
29342934
2935-
.. _alpha-core-CastSize:
2936-
2937-
alpha.core.CastSize (C)
2938-
"""""""""""""""""""""""
2939-
Check when casting a malloc'ed type ``T``, whether the size is a multiple of the size of ``T``.
2940-
2941-
.. code-block:: c
2942-
2943-
void test() {
2944-
int *x = (int *) malloc(11); // warn
2945-
}
2946-
29472935
.. _alpha-core-CastToStruct:
29482936
29492937
alpha.core.CastToStruct (C, C++)

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ TARGET_BUILTIN(__builtin_amdgcn_global_load_monitor_b128, "V4iV4i*1Ii", "nc", "g
667667
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b32, "ii*0Ii", "nc", "gfx1250-insts")
668668
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b64, "V2iV2i*0Ii", "nc", "gfx1250-insts")
669669
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b128, "V4iV4i*0Ii", "nc", "gfx1250-insts")
670+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b32, "ii*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
671+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b64, "V2iV2i*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
672+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b128, "V4iV4i*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
670673
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b8, "vc*1c*3IiIi", "nc", "gfx1250-insts")
671674
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b32, "vi*1i*3IiIi", "nc", "gfx1250-insts")
672675
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b64, "vV2i*1V2i*3IiIi", "nc", "gfx1250-insts")

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,10 @@ let Features = "avx512dq,evex512", Attributes = [NoThrow, Const, RequiredVectorW
19931993
}
19941994

19951995
let Features = "avx512f,evex512", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1996+
def psllv16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
1997+
def psrav16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
1998+
def psrlv16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
1999+
19962000
def prold512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Constant int)">;
19972001
def prord512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Constant int)">;
19982002
def prolq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Constant int)">;
@@ -2422,15 +2426,12 @@ let Features = "avx512vl",
24222426
let Features = "avx512f,evex512", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
24232427
def pslld512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>)">;
24242428
def psllq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
2425-
def psllv16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
24262429
def psllv8di : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>)">;
24272430
def psrad512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>)">;
24282431
def psraq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
2429-
def psrav16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
24302432
def psrav8di : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>)">;
24312433
def psrld512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>)">;
24322434
def psrlq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
2433-
def psrlv16si : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>)">;
24342435
def psrlv8di : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>)">;
24352436
def pternlogd512_mask : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
24362437
def pternlogd512_maskz : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ def err_drv_optimization_remark_format : Error<
361361
def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">;
362362
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
363363
def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">;
364-
def err_drv_omp_host_ir_file_not_found : Error<
365-
"provided host compiler IR file '%0' is required to generate code for OpenMP "
366-
"target regions but cannot be found">;
367364
def err_drv_omp_host_target_not_supported : Error<
368365
"target '%0' is not a supported OpenMP host target">;
369366
def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ def err_target_unsupported_type_for_abi
312312
: Error<"%0 requires %1 type support, but ABI '%2' does not support it">;
313313
}
314314

315+
def err_omp_host_ir_file_not_found : Error<
316+
"provided host compiler IR file '%0' is required to generate code for OpenMP "
317+
"target regions but cannot be found">;
315318
def err_alias_to_undefined : Error<
316319
"%select{alias|ifunc}0 must point to a defined "
317320
"%select{variable or |}1function">;

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
160160
}
161161

162162
cir::LoadOp createLoad(mlir::Location loc, mlir::Value ptr,
163-
uint64_t alignment = 0) {
163+
bool isVolatile = false, uint64_t alignment = 0) {
164164
mlir::IntegerAttr alignmentAttr = getAlignmentAttr(alignment);
165-
assert(!cir::MissingFeatures::opLoadStoreVolatile());
166-
return cir::LoadOp::create(*this, loc, ptr, /*isDeref=*/false,
165+
return cir::LoadOp::create(*this, loc, ptr, /*isDeref=*/false, isVolatile,
167166
alignmentAttr, cir::MemOrderAttr{});
168167
}
169168

170169
mlir::Value createAlignedLoad(mlir::Location loc, mlir::Value ptr,
171170
uint64_t alignment) {
172-
return createLoad(loc, ptr, alignment);
171+
return createLoad(loc, ptr, /*isVolatile=*/false, alignment);
173172
}
174173

175174
mlir::Value createNot(mlir::Value value) {
@@ -250,7 +249,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
250249
bool isVolatile = false,
251250
mlir::IntegerAttr align = {},
252251
cir::MemOrderAttr order = {}) {
253-
return cir::StoreOp::create(*this, loc, val, dst, align, order);
252+
return cir::StoreOp::create(*this, loc, val, dst, isVolatile, align, order);
254253
}
255254

256255
[[nodiscard]] cir::GlobalOp createGlobal(mlir::ModuleOp mlirModule,
@@ -274,7 +273,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
274273
mlir::IntegerAttr alignmentAttr = getAlignmentAttr(alignment);
275274
auto addr = createAlloca(loc, getPointerTo(type), type, {}, alignmentAttr);
276275
return cir::LoadOp::create(*this, loc, addr, /*isDeref=*/false,
277-
alignmentAttr, /*mem_order=*/{});
276+
/*isVolatile=*/false, alignmentAttr,
277+
/*mem_order=*/{});
278278
}
279279

280280
cir::PtrStrideOp createPtrStride(mlir::Location loc, mlir::Value base,

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ def CIR_LoadOp : CIR_Op<"load", [
404404
`cir.load` reads a value (lvalue to rvalue conversion) given an address
405405
backed up by a `cir.ptr` type. A unit attribute `deref` can be used to
406406
mark the resulting value as used by another operation to dereference
407-
a pointer.
407+
a pointer. A unit attribute `volatile` can be used to indicate a volatile
408+
loading. Load can be marked atomic by using `atomic(<mem_order>)`.
409+
410+
`alignment` can be used to specify an alignment that's different from the
411+
default, which is computed from `result`'s type ABI data layout.
408412

409413
Example:
410414

@@ -416,18 +420,26 @@ def CIR_LoadOp : CIR_Op<"load", [
416420
// Load address from memory at address %0. %3 is used by at least one
417421
// operation that dereferences a pointer.
418422
%3 = cir.load deref %0 : !cir.ptr<!cir.ptr<i32>>
423+
424+
// Perform a volatile load from address in %0.
425+
%4 = cir.load volatile %0 : !cir.ptr<i32>, i32
426+
427+
// Others
428+
%x = cir.load align(16) atomic(seq_cst) %0 : !cir.ptr<i32>, i32
419429
```
420430
}];
421431

422432
let arguments = (ins Arg<CIR_PointerType, "the address to load from",
423433
[MemRead]>:$addr,
424434
UnitAttr:$isDeref,
435+
UnitAttr:$is_volatile,
425436
OptionalAttr<I64Attr>:$alignment,
426437
OptionalAttr<CIR_MemOrder>:$mem_order);
427438
let results = (outs CIR_AnyType:$result);
428439

429440
let assemblyFormat = [{
430441
(`deref` $isDeref^)?
442+
(`volatile` $is_volatile^)?
431443
(`align` `(` $alignment^ `)`)?
432444
(`atomic` `(` $mem_order^ `)`)?
433445
$addr `:` qualified(type($addr)) `,` type($result) attr-dict
@@ -452,24 +464,32 @@ def CIR_StoreOp : CIR_Op<"store", [
452464
a volatile store. Store's can be marked atomic by using
453465
`atomic(<mem_order>)`.
454466

455-
`align` can be used to specify an alignment that's different from the
467+
`alignment` can be used to specify an alignment that's different from the
456468
default, which is computed from `result`'s type ABI data layout.
457469

458470
Example:
459471

460472
```mlir
461473
// Store a function argument to local storage, address in %0.
462474
cir.store %arg0, %0 : i32, !cir.ptr<i32>
475+
476+
// Perform a volatile store into memory location at the address in %0.
477+
cir.store volatile %arg0, %0 : i32, !cir.ptr<i32>
478+
479+
// Others
480+
cir.store align(16) atomic(seq_cst) %x, %addr : i32, !cir.ptr<i32>
463481
```
464482
}];
465483

466484
let arguments = (ins CIR_AnyType:$value,
467485
Arg<CIR_PointerType, "the address to store the value",
468486
[MemWrite]>:$addr,
487+
UnitAttr:$is_volatile,
469488
OptionalAttr<I64Attr>:$alignment,
470489
OptionalAttr<CIR_MemOrder>:$mem_order);
471490

472491
let assemblyFormat = [{
492+
(`volatile` $is_volatile^)?
473493
(`align` `(` $alignment^ `)`)?
474494
(`atomic` `(` $mem_order^ `)`)?
475495
$value `,` $addr attr-dict `:` type($value) `,` qualified(type($addr))

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ struct MissingFeatures {
4747
// Load/store attributes
4848
static bool opLoadStoreThreadLocal() { return false; }
4949
static bool opLoadEmitScalarRangeCheck() { return false; }
50-
static bool opLoadBooleanRepresentation() { return false; }
50+
static bool opLoadStoreNontemporal() { return false; }
5151
static bool opLoadStoreTbaa() { return false; }
52-
static bool opLoadStoreVolatile() { return false; }
5352
static bool opLoadStoreAtomic() { return false; }
5453
static bool opLoadStoreObjC() { return false; }
5554

0 commit comments

Comments
 (0)