Skip to content

Commit 46187e6

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents 13cae75 + 8c75d1e commit 46187e6

File tree

194 files changed

+6920
-832
lines changed

Some content is hidden

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

194 files changed

+6920
-832
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
path: |
8080
**/test-results.xml
8181
**/*.abilist
82+
**/CMakeConfigureLog.yaml
8283
**/CMakeError.log
8384
**/CMakeOutput.log
8485
**/crash_diagnostics/*
@@ -123,6 +124,7 @@ jobs:
123124
path: |
124125
**/test-results.xml
125126
**/*.abilist
127+
**/CMakeConfigureLog.yaml
126128
**/CMakeError.log
127129
**/CMakeOutput.log
128130
**/crash_diagnostics/*
@@ -188,6 +190,7 @@ jobs:
188190
path: |
189191
**/test-results.xml
190192
**/*.abilist
193+
**/CMakeConfigureLog.yaml
191194
**/CMakeError.log
192195
**/CMakeOutput.log
193196
**/crash_diagnostics/*
@@ -230,6 +233,7 @@ jobs:
230233
path: |
231234
**/test-results.xml
232235
**/*.abilist
236+
**/CMakeConfigureLog.yaml
233237
**/CMakeError.log
234238
**/CMakeOutput.log
235239
**/crash_diagnostics/*

clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct CognitiveComplexity final {
126126
// Limit of 25 is the "upstream"'s default.
127127
static constexpr unsigned DefaultLimit = 25U;
128128

129-
// Based on the publicly-avaliable numbers for some big open-source projects
129+
// Based on the publicly-available numbers for some big open-source projects
130130
// https://sonarcloud.io/projects?languages=c%2Ccpp&size=5 we can estimate:
131131
// value ~20 would result in no allocs for 98% of functions, ~12 for 96%, ~10
132132
// for 91%, ~8 for 88%, ~6 for 84%, ~4 for 77%, ~2 for 64%, and ~1 for 37%.

clang-tools-extra/test/clang-tidy/checkers/readability/function-cognitive-complexity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ void unittest_false() {
6969
//----------------------------------------------------------------------------//
7070

7171
// break does not increase cognitive complexity.
72-
// only break LABEL does, but it is unavaliable in C or C++
72+
// only break LABEL does, but it is unavailable in C or C++
7373

7474
// continue does not increase cognitive complexity.
75-
// only continue LABEL does, but it is unavaliable in C or C++
75+
// only continue LABEL does, but it is unavailable in C or C++
7676

7777
void unittest_b1_00() {
7878
// CHECK-NOTES: :[[@LINE-1]]:6: warning: function 'unittest_b1_00' has cognitive complexity of 33 (threshold 0) [readability-function-cognitive-complexity]

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12718,7 +12718,18 @@ def err_acc_num_arg_conflict
1271812718
def err_acc_clause_in_clause_region
1271912719
: Error<"loop with a '%0' clause may not exist in the region of a '%1' "
1272012720
"clause%select{| on a 'kernels' compute construct}2">;
12721-
12721+
def err_acc_gang_reduction_conflict
12722+
: Error<"%select{OpenACC 'gang' clause with a 'dim' value greater than "
12723+
"1|OpenACC 'reduction' clause}0 cannot "
12724+
"appear on the same 'loop' construct as a %select{'reduction' "
12725+
"clause|'gang' clause with a 'dim' value greater than 1}0">;
12726+
def err_acc_gang_reduction_numgangs_conflict
12727+
: Error<"OpenACC '%0' clause cannot appear on the same 'loop' construct "
12728+
"as a '%1' clause inside a compute construct with a "
12729+
"'num_gangs' clause with more than one argument">;
12730+
def err_reduction_op_mismatch
12731+
: Error<"OpenACC 'reduction' variable must have the same operator in all "
12732+
"nested constructs (%0 vs %1)">;
1272212733
// AMDGCN builtins diagnostics
1272312734
def err_amdgcn_global_load_lds_size_invalid_value : Error<"invalid size value">;
1272412735
def note_amdgcn_global_load_lds_size_valid_value : Note<"size must be 1, 2, or 4">;

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class SemaOpenACC : public SemaBase {
6868
/// used to diagnose if there are multiple 'for' loops at any one level.
6969
LLVM_PREFERRED_TYPE(bool)
7070
unsigned CurLevelHasLoopAlready : 1;
71+
7172
} LoopInfo{/*TopLevelLoopSeen=*/false, /*CurLevelHasLoopAlready=*/false};
7273

7374
/// The 'collapse' clause requires quite a bit of checking while
@@ -109,6 +110,14 @@ class SemaOpenACC : public SemaBase {
109110
bool TileDepthSatisfied = true;
110111
} TileInfo;
111112

113+
/// A list of the active reduction clauses, which allows us to check that all
114+
/// vars on nested constructs for the same reduction var have the same
115+
/// reduction operator. Currently this is enforced against all constructs
116+
/// despite the rule being in the 'loop' section. By current reading, this
117+
/// should apply to all anyway, but we may need to make this more like the
118+
/// 'loop' clause enforcement, where this is 'blocked' by a compute construct.
119+
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
120+
112121
public:
113122
ComputeConstructInfo &getActiveComputeConstructInfo() {
114123
return ActiveComputeConstructInfo;
@@ -615,7 +624,9 @@ class SemaOpenACC : public SemaBase {
615624

616625
/// Called while semantically analyzing the reduction clause, ensuring the var
617626
/// is the correct kind of reference.
618-
ExprResult CheckReductionVar(Expr *VarExpr);
627+
ExprResult CheckReductionVar(OpenACCDirectiveKind DirectiveKind,
628+
OpenACCReductionOperator ReductionOp,
629+
Expr *VarExpr);
619630

620631
/// Called to check the 'var' type is a variable of pointer type, necessary
621632
/// for 'deviceptr' and 'attach' clauses. Returns true on success.
@@ -634,6 +645,22 @@ class SemaOpenACC : public SemaBase {
634645
// Check a single expression on a gang clause.
635646
ExprResult CheckGangExpr(OpenACCGangKind GK, Expr *E);
636647

648+
// Does the checking for a 'gang' clause that needs to be done in dependent
649+
// and not dependent cases.
650+
OpenACCClause *
651+
CheckGangClause(ArrayRef<const OpenACCClause *> ExistingClauses,
652+
SourceLocation BeginLoc, SourceLocation LParenLoc,
653+
ArrayRef<OpenACCGangKind> GangKinds,
654+
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);
655+
// Does the checking for a 'reduction ' clause that needs to be done in
656+
// dependent and not dependent cases.
657+
OpenACCClause *
658+
CheckReductionClause(ArrayRef<const OpenACCClause *> ExistingClauses,
659+
OpenACCDirectiveKind DirectiveKind,
660+
SourceLocation BeginLoc, SourceLocation LParenLoc,
661+
OpenACCReductionOperator ReductionOp,
662+
ArrayRef<Expr *> Vars, SourceLocation EndLoc);
663+
637664
ExprResult BuildOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc);
638665
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc);
639666

@@ -686,6 +713,7 @@ class SemaOpenACC : public SemaBase {
686713
SourceLocation OldLoopWorkerClauseLoc;
687714
SourceLocation OldLoopVectorClauseLoc;
688715
llvm::SmallVector<OpenACCLoopConstruct *> ParentlessLoopConstructs;
716+
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
689717
LoopInConstructRAII LoopRAII;
690718

691719
public:

clang/lib/AST/ByteCode/Interp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3062,7 +3062,8 @@ inline bool BitCast(InterpState &S, CodePtr OpPC, bool TargetIsUCharOrByte,
30623062
return false;
30633063

30643064
if constexpr (std::is_same_v<T, Floating>) {
3065-
assert(false && "Implement bitcasting to a floating type");
3065+
assert(Sem);
3066+
S.Stk.push<Floating>(T::bitcastFromMemory(Buff.data(), *Sem));
30663067
} else {
30673068
assert(!Sem);
30683069
S.Stk.push<T>(T::bitcastFromMemory(Buff.data(), ResultBitWidth));

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static bool interp__builtin_ia32_bextr(InterpState &S, CodePtr OpPC,
12541254
const InterpFrame *Frame,
12551255
const Function *Func,
12561256
const CallExpr *Call) {
1257-
if (!Call->getArg(0)->getType()->isIntegerType() ||
1257+
if (Call->getNumArgs() != 2 || !Call->getArg(0)->getType()->isIntegerType() ||
12581258
!Call->getArg(1)->getType()->isIntegerType())
12591259
return false;
12601260

@@ -1286,7 +1286,9 @@ static bool interp__builtin_ia32_bzhi(InterpState &S, CodePtr OpPC,
12861286
const Function *Func,
12871287
const CallExpr *Call) {
12881288
QualType CallType = Call->getType();
1289-
if (!CallType->isIntegerType())
1289+
if (Call->getNumArgs() != 2 || !Call->getArg(0)->getType()->isIntegerType() ||
1290+
!Call->getArg(1)->getType()->isIntegerType() ||
1291+
!CallType->isIntegerType())
12901292
return false;
12911293

12921294
PrimType ValT = *S.Ctx.classify(Call->getArg(0));
@@ -1311,7 +1313,8 @@ static bool interp__builtin_ia32_lzcnt(InterpState &S, CodePtr OpPC,
13111313
const Function *Func,
13121314
const CallExpr *Call) {
13131315
QualType CallType = Call->getType();
1314-
if (!CallType->isIntegerType())
1316+
if (!CallType->isIntegerType() ||
1317+
!Call->getArg(0)->getType()->isIntegerType())
13151318
return false;
13161319

13171320
APSInt Val = peekToAPSInt(S.Stk, *S.Ctx.classify(Call->getArg(0)));
@@ -1324,7 +1327,8 @@ static bool interp__builtin_ia32_tzcnt(InterpState &S, CodePtr OpPC,
13241327
const Function *Func,
13251328
const CallExpr *Call) {
13261329
QualType CallType = Call->getType();
1327-
if (!CallType->isIntegerType())
1330+
if (!CallType->isIntegerType() ||
1331+
!Call->getArg(0)->getType()->isIntegerType())
13281332
return false;
13291333

13301334
APSInt Val = peekToAPSInt(S.Stk, *S.Ctx.classify(Call->getArg(0)));
@@ -1336,7 +1340,7 @@ static bool interp__builtin_ia32_pdep(InterpState &S, CodePtr OpPC,
13361340
const InterpFrame *Frame,
13371341
const Function *Func,
13381342
const CallExpr *Call) {
1339-
if (!Call->getArg(0)->getType()->isIntegerType() ||
1343+
if (Call->getNumArgs() != 2 || !Call->getArg(0)->getType()->isIntegerType() ||
13401344
!Call->getArg(1)->getType()->isIntegerType())
13411345
return false;
13421346

@@ -1361,7 +1365,7 @@ static bool interp__builtin_ia32_pext(InterpState &S, CodePtr OpPC,
13611365
const InterpFrame *Frame,
13621366
const Function *Func,
13631367
const CallExpr *Call) {
1364-
if (!Call->getArg(0)->getType()->isIntegerType() ||
1368+
if (Call->getNumArgs() != 2 || !Call->getArg(0)->getType()->isIntegerType() ||
13651369
!Call->getArg(1)->getType()->isIntegerType())
13661370
return false;
13671371

clang/lib/Driver/ToolChains/PS4CPU.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
248248
Args.MakeArgString("--sysroot=" + TC.getSDKLibraryRootDir()));
249249

250250
// Default to PIE for non-static executables.
251-
const bool PIE = !Relocatable && !Shared && !Static;
252-
if (Args.hasFlag(options::OPT_pie, options::OPT_no_pie, PIE))
251+
const bool PIE = Args.hasFlag(options::OPT_pie, options::OPT_no_pie,
252+
!Relocatable && !Shared && !Static);
253+
if (PIE)
253254
CmdArgs.push_back("-pie");
254255

255256
if (!Relocatable) {
@@ -276,6 +277,12 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
276277
CmdArgs.push_back("-z");
277278
CmdArgs.push_back("start-stop-visibility=hidden");
278279

280+
CmdArgs.push_back("-z");
281+
CmdArgs.push_back("common-page-size=0x4000");
282+
283+
CmdArgs.push_back("-z");
284+
CmdArgs.push_back("max-page-size=0x4000");
285+
279286
// Patch relocated regions of DWARF whose targets are eliminated at link
280287
// time with specific tombstones, such that they're recognisable by the
281288
// PlayStation debugger.
@@ -295,6 +302,11 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
295302
if (Shared)
296303
CmdArgs.push_back("--shared");
297304

305+
// Provide a base address for non-PIE executables. This includes cases where
306+
// -static is supplied without -pie.
307+
if (!Relocatable && !Shared && !PIE)
308+
CmdArgs.push_back("--image-base=0x400000");
309+
298310
assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
299311
if (Output.isFilename()) {
300312
CmdArgs.push_back("-o");

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,12 +1261,12 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
12611261
if (pathContainsInit(Path))
12621262
return false;
12631263

1264+
auto *DRE = dyn_cast<DeclRefExpr>(L);
12641265
// Suppress false positives for code like the one below:
1265-
// Ctor(unique_ptr<T> up) : member(*up), member2(move(up)) {}
1266-
if (IsLocalGslOwner && pathOnlyHandlesGslPointer(Path))
1266+
// Ctor(unique_ptr<T> up) : pointer(up.get()), owner(move(up)) {}
1267+
if (DRE && isRecordWithAttr<OwnerAttr>(DRE->getType()))
12671268
return false;
12681269

1269-
auto *DRE = dyn_cast<DeclRefExpr>(L);
12701270
auto *VD = DRE ? dyn_cast<VarDecl>(DRE->getDecl()) : nullptr;
12711271
if (!VD) {
12721272
// A member was initialized to a local block.

0 commit comments

Comments
 (0)