[KeyInstr] init-agg pattern

This commit is contained in:
Orlando Cazalet-Hyams 2025-04-01 17:08:43 +01:00
parent 1f1f1d5d88
commit 3eae9188c3
2 changed files with 6 additions and 2 deletions

View File

@ -1220,6 +1220,7 @@ void CodeGenFunction::emitStoresForConstant(const VarDecl &D, Address Loc,
}
auto *I = Builder.CreateMemSet(
Loc, llvm::ConstantInt::get(CGM.Int8Ty, Value), SizeVal, isVolatile);
addInstToCurrentSourceAtom(I, nullptr);
if (IsAutoInit)
I->addAnnotationMetadata("auto-init");
return;

View File

@ -6,7 +6,6 @@
// store locations to be included in the atom group.
int g;
char gc;
void a() {
// CHECK: _Z1av()
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
@ -24,9 +23,13 @@ void a() {
// CHECK: store i8 99{{.*}}, !dbg [[G3R1]]
// CHECK: store i8 100{{.*}}, !dbg [[G3R1]]
char big[65536] = { 'a', 'b', 'c', 'd' };
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G4R1:!.*]]
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, };
}
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)