Skip to content

Commit ae116fe

Browse files
committed
merge main into amd-staging
Change-Id: I3b824c955fe38db9e44eb4b816001e4cd91917b1
2 parents d35466f + 737d6ca commit ae116fe

File tree

135 files changed

+3744
-1017
lines changed

Some content is hidden

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

135 files changed

+3744
-1017
lines changed

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,13 @@ BreakFunctionNames("break-funcs",
4646
cl::Hidden,
4747
cl::cat(BoltCategory));
4848

49-
cl::list<std::string>
50-
FunctionPadSpec("pad-funcs", cl::CommaSeparated,
51-
cl::desc("list of functions to pad with amount of bytes"),
52-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
53-
cl::Hidden, cl::cat(BoltCategory));
54-
55-
cl::list<std::string> FunctionPadBeforeSpec(
56-
"pad-funcs-before", cl::CommaSeparated,
57-
cl::desc("list of functions to pad with amount of bytes"),
58-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."), cl::Hidden,
59-
cl::cat(BoltCategory));
49+
static cl::list<std::string>
50+
FunctionPadSpec("pad-funcs",
51+
cl::CommaSeparated,
52+
cl::desc("list of functions to pad with amount of bytes"),
53+
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
54+
cl::Hidden,
55+
cl::cat(BoltCategory));
6056

6157
static cl::opt<bool> MarkFuncs(
6258
"mark-funcs",
@@ -74,12 +70,11 @@ X86AlignBranchBoundaryHotOnly("x86-align-branch-boundary-hot-only",
7470
cl::init(true),
7571
cl::cat(BoltOptCategory));
7672

77-
size_t padFunction(const cl::list<std::string> &Spec,
78-
const BinaryFunction &Function) {
73+
size_t padFunction(const BinaryFunction &Function) {
7974
static std::map<std::string, size_t> FunctionPadding;
8075

81-
if (FunctionPadding.empty() && !Spec.empty()) {
82-
for (const std::string &Spec : Spec) {
76+
if (FunctionPadding.empty() && !FunctionPadSpec.empty()) {
77+
for (std::string &Spec : FunctionPadSpec) {
8378
size_t N = Spec.find(':');
8479
if (N == std::string::npos)
8580
continue;
@@ -324,32 +319,6 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
324319
Streamer.emitCodeAlignment(Function.getAlign(), &*BC.STI);
325320
}
326321

327-
if (size_t Padding =
328-
opts::padFunction(opts::FunctionPadBeforeSpec, Function)) {
329-
// Handle padFuncsBefore after the above alignment logic but before
330-
// symbol addresses are decided.
331-
if (!BC.HasRelocations) {
332-
BC.errs() << "BOLT-ERROR: -pad-before-funcs is not supported in "
333-
<< "non-relocation mode\n";
334-
exit(1);
335-
}
336-
337-
// Preserve Function.getMinAlign().
338-
if (!isAligned(Function.getMinAlign(), Padding)) {
339-
BC.errs() << "BOLT-ERROR: user-requested " << Padding
340-
<< " padding bytes before function " << Function
341-
<< " is not a multiple of the minimum function alignment ("
342-
<< Function.getMinAlign().value() << ").\n";
343-
exit(1);
344-
}
345-
346-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding before function " << Function
347-
<< " with " << Padding << " bytes\n");
348-
349-
// Since the padding is not executed, it can be null bytes.
350-
Streamer.emitFill(Padding, 0);
351-
}
352-
353322
MCContext &Context = Streamer.getContext();
354323
const MCAsmInfo *MAI = Context.getAsmInfo();
355324

@@ -404,7 +373,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
404373
emitFunctionBody(Function, FF, /*EmitCodeOnly=*/false);
405374

406375
// Emit padding if requested.
407-
if (size_t Padding = opts::padFunction(opts::FunctionPadSpec, Function)) {
376+
if (size_t Padding = opts::padFunction(Function)) {
408377
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding function " << Function << " with "
409378
<< Padding << " bytes\n");
410379
Streamer.emitFill(Padding, MAI->getTextAlignFillValue());

bolt/lib/Passes/ReorderFunctions.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ extern cl::OptionCategory BoltOptCategory;
2828
extern cl::opt<unsigned> Verbosity;
2929
extern cl::opt<uint32_t> RandomSeed;
3030

31-
extern size_t padFunction(const cl::list<std::string> &Spec,
32-
const bolt::BinaryFunction &Function);
33-
extern cl::list<std::string> FunctionPadSpec, FunctionPadBeforeSpec;
31+
extern size_t padFunction(const bolt::BinaryFunction &Function);
3432

3533
extern cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions;
3634
cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions(
@@ -306,12 +304,8 @@ Error ReorderFunctions::runOnFunctions(BinaryContext &BC) {
306304
return false;
307305
if (B->isIgnored())
308306
return true;
309-
const size_t PadA =
310-
opts::padFunction(opts::FunctionPadSpec, *A) +
311-
opts::padFunction(opts::FunctionPadBeforeSpec, *A);
312-
const size_t PadB =
313-
opts::padFunction(opts::FunctionPadSpec, *B) +
314-
opts::padFunction(opts::FunctionPadBeforeSpec, *B);
307+
const size_t PadA = opts::padFunction(*A);
308+
const size_t PadB = opts::padFunction(*B);
315309
if (!PadA || !PadB) {
316310
if (PadA)
317311
return true;

bolt/test/AArch64/pad-before-funcs.s

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

clang/bindings/python/clang/cindex.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,12 +2125,26 @@ def get_field_offsetof(self):
21252125

21262126
def is_anonymous(self):
21272127
"""
2128-
Check if the record is anonymous.
2128+
Check whether this is a record type without a name, or a field where
2129+
the type is a record type without a name.
2130+
2131+
Use is_anonymous_record_decl to check whether a record is an
2132+
"anonymous union" as defined in the C/C++ standard.
21292133
"""
21302134
if self.kind == CursorKind.FIELD_DECL:
21312135
return self.type.get_declaration().is_anonymous()
21322136
return conf.lib.clang_Cursor_isAnonymous(self) # type: ignore [no-any-return]
21332137

2138+
def is_anonymous_record_decl(self):
2139+
"""
2140+
Check if the record is an anonymous union as defined in the C/C++ standard
2141+
(or an "anonymous struct", the corresponding non-standard extension for
2142+
structs).
2143+
"""
2144+
if self.kind == CursorKind.FIELD_DECL:
2145+
return self.type.get_declaration().is_anonymous_record_decl()
2146+
return conf.lib.clang_Cursor_isAnonymousRecordDecl(self) # type: ignore [no-any-return]
2147+
21342148
def is_bitfield(self):
21352149
"""
21362150
Check if the field is a bitfield.
@@ -3902,12 +3916,13 @@ def write_main_file_to_stdout(self):
39023916
("clang_Cursor_getTemplateArgumentType", [Cursor, c_uint], Type),
39033917
("clang_Cursor_getTemplateArgumentValue", [Cursor, c_uint], c_longlong),
39043918
("clang_Cursor_getTemplateArgumentUnsignedValue", [Cursor, c_uint], c_ulonglong),
3905-
("clang_Cursor_isAnonymous", [Cursor], bool),
3906-
("clang_Cursor_isBitField", [Cursor], bool),
39073919
("clang_Cursor_getBinaryOpcode", [Cursor], c_int),
39083920
("clang_Cursor_getBriefCommentText", [Cursor], _CXString),
39093921
("clang_Cursor_getRawCommentText", [Cursor], _CXString),
39103922
("clang_Cursor_getOffsetOfField", [Cursor], c_longlong),
3923+
("clang_Cursor_isAnonymous", [Cursor], bool),
3924+
("clang_Cursor_isAnonymousRecordDecl", [Cursor], bool),
3925+
("clang_Cursor_isBitField", [Cursor], bool),
39113926
("clang_Location_isInSystemHeader", [SourceLocation], bool),
39123927
("clang_Type_getAlignOf", [Type], c_longlong),
39133928
("clang_Type_getClassType", [Type], Type),

clang/bindings/python/tests/cindex/test_type.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,11 @@ def test_offset(self):
463463
self.assertNotEqual(children[0].spelling, "typeanon")
464464
self.assertEqual(children[1].spelling, "typeanon")
465465
self.assertEqual(fields[0].kind, CursorKind.FIELD_DECL)
466+
self.assertTrue(fields[0].is_anonymous())
467+
self.assertFalse(fields[0].is_anonymous_record_decl())
466468
self.assertEqual(fields[1].kind, CursorKind.FIELD_DECL)
467469
self.assertTrue(fields[1].is_anonymous())
470+
self.assertTrue(fields[1].is_anonymous_record_decl())
468471
self.assertEqual(teststruct.type.get_offset("typeanon"), f1)
469472
self.assertEqual(teststruct.type.get_offset("bariton"), bariton)
470473
self.assertEqual(teststruct.type.get_offset("foo"), foo)

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,8 @@ Sanitizers
13091309
Python Binding Changes
13101310
----------------------
13111311
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.
1312+
- Added binding for ``clang_Cursor_isAnonymousRecordDecl``, which allows checking if
1313+
a declaration is an anonymous union or anonymous struct.
13121314

13131315
OpenMP Support
13141316
--------------

clang/include/clang/Basic/BuiltinsSPIRV.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
include "clang/Basic/BuiltinsBase.td"
1010

11-
def HLSLDistance : Builtin {
11+
def SPIRVDistance : Builtin {
1212
let Spellings = ["__builtin_spirv_distance"];
1313
let Attributes = [NoThrow, Const];
1414
let Prototype = "void(...)";

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,10 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
21022102
MDHelper.createConstant(BranchHintConstant)});
21032103
BrInst->setMetadata("hlsl.controlflow.hint",
21042104
llvm::MDNode::get(CGM.getLLVMContext(), Vals));
2105-
} break;
2105+
break;
2106+
}
2107+
case HLSLControlFlowHintAttr::SpellingNotCalculated:
2108+
break;
21062109
}
21072110
}
21082111

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ using namespace llvm::opt;
1717

1818
SYCLInstallationDetector::SYCLInstallationDetector(
1919
const Driver &D, const llvm::Triple &HostTriple,
20-
const llvm::opt::ArgList &Args)
21-
: D(D) {}
20+
const llvm::opt::ArgList &Args) {}
2221

2322
void SYCLInstallationDetector::addSYCLIncludeArgs(
2423
const ArgList &DriverArgs, ArgStringList &CC1Args) const {
@@ -31,8 +30,8 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
3130
}
3231

3332
// Unsupported options for SYCL device compilation.
34-
static ArrayRef<OptSpecifier> getUnsupportedOpts() {
35-
return {
33+
static ArrayRef<options::ID> getUnsupportedOpts() {
34+
static constexpr options::ID UnsupportedOpts[] = {
3635
options::OPT_fsanitize_EQ, // -fsanitize
3736
options::OPT_fcf_protection_EQ, // -fcf-protection
3837
options::OPT_fprofile_generate,
@@ -53,7 +52,9 @@ static ArrayRef<OptSpecifier> getUnsupportedOpts() {
5352
options::OPT_fprofile_instr_use_EQ, // -fprofile-instr-use
5453
options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
5554
options::OPT_fcs_profile_generate, // -fcs-profile-generate
56-
options::OPT_fcs_profile_generate_EQ};
55+
options::OPT_fcs_profile_generate_EQ,
56+
};
57+
return UnsupportedOpts;
5758
}
5859

5960
SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,

clang/lib/Driver/ToolChains/SYCL.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class SYCLInstallationDetector {
2222

2323
void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
2424
llvm::opt::ArgStringList &CC1Args) const;
25-
26-
private:
27-
const Driver &D;
2825
};
2926

3027
namespace toolchains {

clang/test/Driver/print-supported-extensions-riscv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
// CHECK-NEXT: xqcia 0.2 'Xqcia' (Qualcomm uC Arithmetic Extension)
194194
// CHECK-NEXT: xqciac 0.2 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
195195
// CHECK-NEXT: xqcicli 0.2 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
196+
// CHECK-NEXT: xqcicm 0.2 'Xqcicm' (Qualcomm uC Conditional Move Extension)
196197
// CHECK-NEXT: xqcics 0.2 'Xqcics' (Qualcomm uC Conditional Select Extension)
197198
// CHECK-NEXT: xqcicsr 0.2 'Xqcicsr' (Qualcomm uC CSR Extension)
198199
// CHECK-NEXT: xqcilsm 0.2 'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)

clang/test/Driver/sycl-offload-jit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// Check the phases graph with -fsycl. Use of -fsycl enables offload
44
// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \
55
// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
6-
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl %s 2>&1 \
6+
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- %s 2>&1 \
77
// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
88
// CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
99
// CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
@@ -35,7 +35,7 @@
3535
// RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
3636
// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
3737
// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
38-
// RUN: %clang_cl -### -fsycl -c %s 2>&1 \
38+
// RUN: %clang_cl -### -fsycl -c -- %s 2>&1 \
3939
// RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
4040
// RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
4141
// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s

flang/lib/Common/Fortran.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
136136
if (*x == CUDADataAttr::Device) {
137137
if ((y &&
138138
(*y == CUDADataAttr::Managed || *y == CUDADataAttr::Unified ||
139-
*y == CUDADataAttr::Shared)) ||
139+
*y == CUDADataAttr::Shared ||
140+
*y == CUDADataAttr::Constant)) ||
140141
(!y && (isCudaUnified || isCudaManaged))) {
141142
if (y && *y == CUDADataAttr::Shared && warning) {
142143
*warning = "SHARED attribute ignored"s;

flang/test/Driver/parse-error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
; RUN: not %flang_fc1 -fdebug-unparse-no-sema -x f95 %s 2>&1 | FileCheck %s --check-prefix=ERROR
1414
; RUN: not %flang_fc1 -fsyntax-only %s -x f95 2>&1 | FileCheck %s --check-prefix=ERROR
1515

16-
; ERROR: Could not scan {{.*}}parse-error.f95
16+
; ERROR: Could not scan {{.*}}parse-error.ll
1717

1818
define void @foo() {
1919
ret void

flang/test/Semantics/cuf10.cuf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
module m
33
real, device :: a(4,8)
44
real, managed, allocatable :: b(:,:)
5+
integer, constant :: x = 1
56
contains
67
attributes(global) subroutine kernel(a,b,c,n,m)
78
integer, value :: n
@@ -23,4 +24,10 @@ module m
2324
call devsub(c,4) ! not checked in OpenACC construct
2425
end do
2526
end
27+
attributes(global) subroutine sub1(x)
28+
integer :: x
29+
end
30+
subroutine sub2()
31+
call sub1<<<1,1>>>(x) ! actual constant to device dummy
32+
end
2633
end
File renamed without changes.

0 commit comments

Comments
 (0)