Skip to content

Commit 00efb47

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I9e41889ea6c2b096c355e96dc06aac8a33e71f86
2 parents 8fcc02e + 8ecc377 commit 00efb47

File tree

66 files changed

+966
-389
lines changed

Some content is hidden

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

66 files changed

+966
-389
lines changed

clang/docs/ClangFormat.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
6161
--dry-run - If set, do not actually make the formatting changes
6262
--dump-config - Dump configuration options to stdout and exit.
6363
Can be used with -style option.
64+
--fail-on-incomplete-format - If set, fail with exit code 1 on incomplete format.
6465
--fallback-style=<string> - The name of the predefined style used as a
6566
fallback in case clang-format is invoked with
6667
-style=file, but can not find the .clang-format

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,27 +1248,38 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
12481248
return;
12491249
}
12501250

1251-
// If the initializer is small, use a handful of stores.
1251+
// If the initializer is small or trivialAutoVarInit is set, use a handful of
1252+
// stores.
1253+
bool IsTrivialAutoVarInitPattern =
1254+
CGM.getContext().getLangOpts().getTrivialAutoVarInit() ==
1255+
LangOptions::TrivialAutoVarInitKind::Pattern;
12521256
if (shouldSplitConstantStore(CGM, ConstantSize)) {
12531257
if (auto *STy = dyn_cast<llvm::StructType>(Ty)) {
1254-
const llvm::StructLayout *Layout =
1255-
CGM.getDataLayout().getStructLayout(STy);
1256-
for (unsigned i = 0; i != constant->getNumOperands(); i++) {
1257-
CharUnits CurOff = CharUnits::fromQuantity(Layout->getElementOffset(i));
1258-
Address EltPtr = Builder.CreateConstInBoundsByteGEP(
1259-
Loc.withElementType(CGM.Int8Ty), CurOff);
1260-
emitStoresForConstant(CGM, D, EltPtr, isVolatile, Builder,
1261-
constant->getAggregateElement(i), IsAutoInit);
1258+
if (STy == Loc.getElementType() ||
1259+
(STy != Loc.getElementType() && IsTrivialAutoVarInitPattern)) {
1260+
const llvm::StructLayout *Layout =
1261+
CGM.getDataLayout().getStructLayout(STy);
1262+
for (unsigned i = 0; i != constant->getNumOperands(); i++) {
1263+
CharUnits CurOff =
1264+
CharUnits::fromQuantity(Layout->getElementOffset(i));
1265+
Address EltPtr = Builder.CreateConstInBoundsByteGEP(
1266+
Loc.withElementType(CGM.Int8Ty), CurOff);
1267+
emitStoresForConstant(CGM, D, EltPtr, isVolatile, Builder,
1268+
constant->getAggregateElement(i), IsAutoInit);
1269+
}
1270+
return;
12621271
}
1263-
return;
12641272
} else if (auto *ATy = dyn_cast<llvm::ArrayType>(Ty)) {
1265-
for (unsigned i = 0; i != ATy->getNumElements(); i++) {
1266-
Address EltPtr = Builder.CreateConstGEP(
1267-
Loc.withElementType(ATy->getElementType()), i);
1268-
emitStoresForConstant(CGM, D, EltPtr, isVolatile, Builder,
1269-
constant->getAggregateElement(i), IsAutoInit);
1273+
if (ATy == Loc.getElementType() ||
1274+
(ATy != Loc.getElementType() && IsTrivialAutoVarInitPattern)) {
1275+
for (unsigned i = 0; i != ATy->getNumElements(); i++) {
1276+
Address EltPtr = Builder.CreateConstGEP(
1277+
Loc.withElementType(ATy->getElementType()), i);
1278+
emitStoresForConstant(CGM, D, EltPtr, isVolatile, Builder,
1279+
constant->getAggregateElement(i), IsAutoInit);
1280+
}
1281+
return;
12701282
}
1271-
return;
12721283
}
12731284
}
12741285

clang/test/CodeGen/aapcs-align.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ void g6() {
134134
f6m(1, 2, 3, 4, 5, s);
135135
}
136136
// CHECK: define{{.*}} void @g6
137-
// CHECK: call void @f6(i32 noundef 1, [4 x i32] [i32 6, i32 7, i32 0, i32 0])
138-
// CHECK: call void @f6m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [4 x i32] [i32 6, i32 7, i32 0, i32 0])
137+
// CHECK: call void @f6(i32 noundef 1, [4 x i32] [i32 6, i32 7, i32 0, i32 undef])
138+
// CHECK: call void @f6m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [4 x i32] [i32 6, i32 7, i32 0, i32 undef])
139139
// CHECK: declare void @f6(i32 noundef, [4 x i32])
140140
// CHECK: declare void @f6m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [4 x i32])
141141
}

clang/test/CodeGen/aapcs64-align.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ void g4() {
7575
f4m(1, 2, 3, 4, 5, s);
7676
}
7777
// CHECK: define{{.*}} void @g4()
78-
// CHECK: call void @f4(i32 noundef 1, [2 x i64] %{{.*}})
79-
// CHECK: void @f4m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] %{{.*}})
78+
// CHECK: call void @f4(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0])
79+
// CHECK: void @f4m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0])
8080
// CHECK: declare void @f4(i32 noundef, [2 x i64])
8181
// CHECK: declare void @f4m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64])
8282

@@ -95,8 +95,8 @@ void f5m(int, int, int, int, int, P16);
9595
f5m(1, 2, 3, 4, 5, s);
9696
}
9797
// CHECK: define{{.*}} void @g5()
98-
// CHECK: call void @f5(i32 noundef 1, [2 x i64] %{{.*}})
99-
// CHECK: void @f5m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] %{{.*}})
98+
// CHECK: call void @f5(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0])
99+
// CHECK: void @f5m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0])
100100
// CHECK: declare void @f5(i32 noundef, [2 x i64])
101101
// CHECK: declare void @f5m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64])
102102

clang/test/CodeGen/attr-counted-by.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,17 +1314,10 @@ int test14(int idx) {
13141314
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local i32 @test15(
13151315
// NO-SANITIZE-WITH-ATTR-SAME: i32 noundef [[IDX:%.*]]) local_unnamed_addr #[[ATTR4]] {
13161316
// NO-SANITIZE-WITH-ATTR-NEXT: entry:
1317-
// NO-SANITIZE-WITH-ATTR-NEXT: [[FOO:%.*]] = alloca [[STRUCT_ANON_8:%.*]], align 4
1318-
// NO-SANITIZE-WITH-ATTR-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr nonnull [[FOO]]) #[[ATTR12]]
1319-
// NO-SANITIZE-WITH-ATTR-NEXT: store i32 1, ptr [[FOO]], align 4
1320-
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 4
1321-
// NO-SANITIZE-WITH-ATTR-NEXT: store i32 2, ptr [[TMP0]], align 4
1322-
// NO-SANITIZE-WITH-ATTR-NEXT: [[BLAH:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 8
13231317
// NO-SANITIZE-WITH-ATTR-NEXT: [[IDXPROM:%.*]] = sext i32 [[IDX]] to i64
1324-
// NO-SANITIZE-WITH-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [0 x i32], ptr [[BLAH]], i64 0, i64 [[IDXPROM]]
1325-
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
1326-
// NO-SANITIZE-WITH-ATTR-NEXT: call void @llvm.lifetime.end.p0(i64 8, ptr nonnull [[FOO]]) #[[ATTR12]]
1327-
// NO-SANITIZE-WITH-ATTR-NEXT: ret i32 [[TMP1]]
1318+
// NO-SANITIZE-WITH-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [0 x i32], ptr getelementptr inbounds ([[STRUCT_ANON_8:%.*]], ptr @__const.test15.foo, i64 1, i32 0), i64 0, i64 [[IDXPROM]]
1319+
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
1320+
// NO-SANITIZE-WITH-ATTR-NEXT: ret i32 [[TMP0]]
13281321
//
13291322
// SANITIZE-WITHOUT-ATTR-LABEL: define dso_local i32 @test15(
13301323
// SANITIZE-WITHOUT-ATTR-SAME: i32 noundef [[IDX:%.*]]) local_unnamed_addr #[[ATTR0]] {
@@ -1342,17 +1335,10 @@ int test14(int idx) {
13421335
// NO-SANITIZE-WITHOUT-ATTR-LABEL: define dso_local i32 @test15(
13431336
// NO-SANITIZE-WITHOUT-ATTR-SAME: i32 noundef [[IDX:%.*]]) local_unnamed_addr #[[ATTR1]] {
13441337
// NO-SANITIZE-WITHOUT-ATTR-NEXT: entry:
1345-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[FOO:%.*]] = alloca [[STRUCT_ANON_8:%.*]], align 4
1346-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr nonnull [[FOO]]) #[[ATTR9]]
1347-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: store i32 1, ptr [[FOO]], align 4
1348-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 4
1349-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: store i32 2, ptr [[TMP0]], align 4
1350-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[BLAH:%.*]] = getelementptr inbounds i8, ptr [[FOO]], i64 8
13511338
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[IDXPROM:%.*]] = sext i32 [[IDX]] to i64
1352-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [0 x i32], ptr [[BLAH]], i64 0, i64 [[IDXPROM]]
1353-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
1354-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: call void @llvm.lifetime.end.p0(i64 8, ptr nonnull [[FOO]]) #[[ATTR9]]
1355-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: ret i32 [[TMP1]]
1339+
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [0 x i32], ptr getelementptr inbounds ([[STRUCT_ANON_8:%.*]], ptr @__const.test15.foo, i64 1, i32 0), i64 0, i64 [[IDXPROM]]
1340+
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
1341+
// NO-SANITIZE-WITHOUT-ATTR-NEXT: ret i32 [[TMP0]]
13561342
//
13571343
int test15(int idx) {
13581344
struct {

clang/test/CodeGenCXX/auto-var-init.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,CHECK-O0
22
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,PATTERN,PATTERN-O0
3-
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O1,PATTERN,PATTERN-O1
3+
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=PATTERN,PATTERN-O1
44
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,ZERO,ZERO-O0
5-
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O1,ZERO,ZERO-O1
5+
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=ZERO,ZERO-O1
66
// RUN: %clang_cc1 -std=c++14 -triple i386-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,PATTERN,PATTERN-O0
77

88
#pragma clang diagnostic ignored "-Winaccessible-base"
@@ -1303,9 +1303,10 @@ TEST_CUSTOM(semivolatile, semivolatile, { 0x44444444, 0x44444444 });
13031303
// CHECK-O0: call void @llvm.memcpy
13041304
// CHECK-NOT: !annotation
13051305
// CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1306-
// CHECK-O1: store i32 1145324612, ptr %custom, align 4
1307-
// CHECK-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds i8, ptr %custom, i64 4
1308-
// CHECK-O1-NEXT: store i32 1145324612, ptr %[[I]], align 4
1306+
// PATTERN-O1: store i32 1145324612, ptr %custom, align 4
1307+
// PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds i8, ptr %custom, i64 4
1308+
// PATTERN-O1-NEXT: store i32 1145324612, ptr %[[I]], align 4
1309+
// ZERO-O1: store i64 4919131752989213764, ptr %custom, align 8
13091310
// CHECK-NOT: !annotation
13101311

13111312
TEST_UNINIT(semivolatileinit, semivolatileinit);
@@ -1418,7 +1419,8 @@ TEST_CUSTOM(matching, matching, { .f = 0xf00f });
14181419
// CHECK-O0: call void @llvm.memcpy
14191420
// CHECK-NOT: !annotation
14201421
// CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1421-
// CHECK-O1: store float 6.145500e+04, ptr {{.*}}, align 4
1422+
// PATTERN-O1: store float 6.145500e+04, ptr {{.*}}, align 4
1423+
// ZERO-O1: store i32 1198526208, ptr %custom, align 4
14221424
// CHECK-NOT: !annotation
14231425

14241426
TEST_UNINIT(matchingreverse, matchingreverse);
@@ -1445,7 +1447,8 @@ TEST_CUSTOM(matchingreverse, matchingreverse, { .i = 0xf00f });
14451447
// CHECK-O0: call void @llvm.memcpy
14461448
// CHECK-NOT: !annotation
14471449
// CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1448-
// CHECK-O1: store i32 61455, ptr %custom, align 4
1450+
// PATTERN-O1: store i32 61455, ptr %custom, align 4
1451+
// ZERO-O1: store i32 61455, ptr %custom, align 4
14491452
// CHECK-NOT: !annotation
14501453

14511454
TEST_UNINIT(unmatched, unmatched);
@@ -1471,7 +1474,8 @@ TEST_CUSTOM(unmatched, unmatched, { .i = 0x3badbeef });
14711474
// CHECK-O0: call void @llvm.memcpy
14721475
// CHECK-NOT: !annotation
14731476
// CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1474-
// CHECK-O1: store i32 1001242351, ptr {{.*}}, align 4
1477+
// PATTERN-O1: store i32 1001242351, ptr {{.*}}, align 4
1478+
// ZERO-O1: store i32 1001242351, ptr {{.*}}, align 4
14751479
// CHECK-NOT: !annotation
14761480

14771481
TEST_UNINIT(unmatchedreverse, unmatchedreverse);
@@ -1504,9 +1508,7 @@ TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42 });
15041508
// PATTERN-O1-NEXT: store i8 -86, ptr %[[I]], align {{.*}}
15051509
// PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds i8, ptr %custom, i64 3
15061510
// PATTERN-O1-NEXT: store i8 -86, ptr %[[I]], align {{.*}}
1507-
// ZERO-O1: store i8 42, ptr {{.*}}, align 4
1508-
// ZERO-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds i8, ptr %custom, i64 1
1509-
// ZERO-O1-NEXT: call void @llvm.memset.{{.*}}({{.*}}, i8 0, i64 3, {{.*}})
1511+
// ZERO-O1: store i32 42, ptr {{.*}}, align 4
15101512

15111513
TEST_UNINIT(unmatchedfp, unmatchedfp);
15121514
// CHECK-LABEL: @test_unmatchedfp_uninit()
@@ -1531,7 +1533,8 @@ TEST_CUSTOM(unmatchedfp, unmatchedfp, { .d = 3.1415926535897932384626433 });
15311533
// CHECK-O0: call void @llvm.memcpy
15321534
// CHECK-NOT: !annotation
15331535
// CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1534-
// CHECK-O1: store double 0x400921FB54442D18, ptr %custom, align 8
1536+
// PATTERN-O1: store double 0x400921FB54442D18, ptr %custom, align 8
1537+
// ZERO-O1: store i64 4614256656552045848, ptr %custom, align 8
15351538
// CHECK-NOT: !annotation
15361539

15371540
TEST_UNINIT(emptyenum, emptyenum);

clang/test/CodeGenOpenCL/amdgpu-printf.cl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ __kernel void test_printf_int(int i) {
3030
// CHECK-NEXT: [[S:%.*]] = alloca [4 x i8], align 1, addrspace(5)
3131
// CHECK-NEXT: store i32 [[I:%.*]], ptr addrspace(5) [[I_ADDR]], align 4, !tbaa [[TBAA9]]
3232
// CHECK-NEXT: call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[S]]) #[[ATTR5:[0-9]+]]
33-
// CHECK-NEXT: [[LOC0:%.*]] = getelementptr i8, ptr addrspace(5) [[S]], i64 0
34-
// CHECK-NEXT: store i8 102, ptr addrspace(5) [[LOC0]], align 1
35-
// CHECK-NEXT: [[LOC1:%.*]] = getelementptr i8, ptr addrspace(5) [[S]], i64 1
36-
// CHECK-NEXT: store i8 111, ptr addrspace(5) [[LOC1]], align 1
37-
// CHECK-NEXT: [[LOC2:%.*]] = getelementptr i8, ptr addrspace(5) [[S]], i64 2
38-
// CHECK-NEXT: store i8 111, ptr addrspace(5) [[LOC2]], align 1
39-
// CHECK-NEXT: [[LOC3:%.*]] = getelementptr i8, ptr addrspace(5) [[S]], i64 3
40-
// CHECK-NEXT: store i8 0, ptr addrspace(5) [[LOC3]], align 1
33+
// CHECK-NEXT: call void @llvm.memcpy.p5.p4.i64(ptr addrspace(5) align 1 [[S]], ptr addrspace(4) align 1 @__const.test_printf_str_int.s, i64 4, i1 false)
4134
// CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [4 x i8], ptr addrspace(5) [[S]], i64 0, i64 0
4235
// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[I_ADDR]], align 4, !tbaa [[TBAA9]]
4336
// CHECK-NEXT: [[CALL:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) noundef @.str.2, ptr addrspace(5) noundef [[ARRAYDECAY]], i32 noundef [[TMP0]]) #[[ATTR4]]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: not clang-format -style=LLVM -fail-on-incomplete-format %s
2+
// RUN: clang-format -style=LLVM %s
3+
4+
int a(

clang/test/OpenMP/bug54082.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ void foo() {
6969
// CHECK-NEXT: [[X_TRAITS:%.*]] = alloca [1 x %struct.omp_alloctrait_t], align 16
7070
// CHECK-NEXT: [[X_ALLOC:%.*]] = alloca i64, align 8
7171
// CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[X_TRAITS]]) #[[ATTR5:[0-9]+]]
72-
// CHECK-NEXT: store i32 2, ptr [[X_TRAITS]], align 16
73-
// CHECK-NEXT: [[LOC0:%.*]] = getelementptr inbounds i8, ptr [[X_TRAITS]], i64 8
74-
// CHECK-NEXT: store i64 64, ptr [[LOC0]], align 8
72+
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) [[X_TRAITS]], ptr noundef nonnull align 16 dereferenceable(16) @__const.foo.x_traits, i64 16, i1 false)
7573
// CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr nonnull [[X_ALLOC]]) #[[ATTR5]]
7674
// CHECK-NEXT: [[CALL:%.*]] = call i64 @omp_init_allocator(i64 noundef 0, i32 noundef 1, ptr noundef nonnull [[X_TRAITS]]) #[[ATTR5]]
7775
// CHECK-NEXT: store i64 [[CALL]], ptr [[X_ALLOC]], align 8, !tbaa [[TBAA3:![0-9]+]]

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ static cl::list<std::string> FileNames(cl::Positional,
205205
cl::desc("[@<file>] [<file> ...]"),
206206
cl::cat(ClangFormatCategory));
207207

208+
static cl::opt<bool> FailOnIncompleteFormat(
209+
"fail-on-incomplete-format",
210+
cl::desc("If set, fail with exit code 1 on incomplete format."),
211+
cl::init(false), cl::cat(ClangFormatCategory));
212+
208213
namespace clang {
209214
namespace format {
210215

@@ -399,7 +404,7 @@ class ClangFormatDiagConsumer : public DiagnosticConsumer {
399404
};
400405

401406
// Returns true on error.
402-
static bool format(StringRef FileName) {
407+
static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
403408
const bool IsSTDIN = FileName == "-";
404409
if (!OutputXML && Inplace && IsSTDIN) {
405410
errs() << "error: cannot use -i when reading from stdin.\n";
@@ -535,7 +540,7 @@ static bool format(StringRef FileName) {
535540
Rewrite.getEditBuffer(ID).write(outs());
536541
}
537542
}
538-
return false;
543+
return ErrorOnIncompleteFormat && !Status.FormatComplete;
539544
}
540545

541546
} // namespace format
@@ -699,7 +704,7 @@ int main(int argc, const char **argv) {
699704
}
700705

701706
if (FileNames.empty())
702-
return clang::format::format("-");
707+
return clang::format::format("-", FailOnIncompleteFormat);
703708

704709
if (FileNames.size() > 1 &&
705710
(!Offsets.empty() || !Lengths.empty() || !LineRanges.empty())) {
@@ -717,7 +722,7 @@ int main(int argc, const char **argv) {
717722
errs() << "Formatting [" << FileNo++ << "/" << FileNames.size() << "] "
718723
<< FileName << "\n";
719724
}
720-
Error |= clang::format::format(FileName);
725+
Error |= clang::format::format(FileName, FailOnIncompleteFormat);
721726
}
722727
return Error ? 1 : 0;
723728
}

llvm/docs/AMDGPUUsage.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,11 @@ The AMDGPU backend supports the following LLVM IR attributes.
14551455
CLANG attribute [CLANG-ATTR]_. Clang only emits this attribute when all
14561456
the three numbers are >= 1.
14571457

1458+
"amdgpu-no-agpr" Indicates the function will not require allocating AGPRs. This is only
1459+
relevant on subtargets with AGPRs. The behavior is undefined if a
1460+
function which requires AGPRs is reached through any function marked
1461+
with this attribute.
1462+
14581463
======================================= ==========================================================
14591464

14601465
Calling Conventions

0 commit comments

Comments
 (0)