Skip to content

Commit 3eae918

Browse files
committed
[KeyInstr] init-agg pattern
1 parent 1f1f1d5 commit 3eae918

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ void CodeGenFunction::emitStoresForConstant(const VarDecl &D, Address Loc,
12201220
}
12211221
auto *I = Builder.CreateMemSet(
12221222
Loc, llvm::ConstantInt::get(CGM.Int8Ty, Value), SizeVal, isVolatile);
1223+
addInstToCurrentSourceAtom(I, nullptr);
12231224
if (IsAutoInit)
12241225
I->addAnnotationMetadata("auto-init");
12251226
return;

clang/test/KeyInstructions/init-agg.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// store locations to be included in the atom group.
77

88
int g;
9-
char gc;
109
void a() {
1110
// CHECK: _Z1av()
1211
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
@@ -24,9 +23,13 @@ void a() {
2423
// CHECK: store i8 99{{.*}}, !dbg [[G3R1]]
2524
// CHECK: store i8 100{{.*}}, !dbg [[G3R1]]
2625
char big[65536] = { 'a', 'b', 'c', 'd' };
26+
27+
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G4R1:!.*]]
28+
char arr[] = { 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, };
2729
}
2830

2931
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
3032
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
3133
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
32-
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
34+
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
35+
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)

0 commit comments

Comments
 (0)