Skip to content

Commit eef73d3

Browse files
committed
[KeyInstr][Clang] Init pattern atom
1 parent 3eae918 commit eef73d3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ void CodeGenFunction::emitStoresForConstant(const VarDecl &D, Address Loc,
11821182
Ty->isPtrOrPtrVectorTy() || Ty->isFPOrFPVectorTy();
11831183
if (canDoSingleStore) {
11841184
auto *I = Builder.CreateStore(constant, Loc, isVolatile);
1185+
addInstToCurrentSourceAtom(I, nullptr);
11851186
if (IsAutoInit)
11861187
I->addAnnotationMetadata("auto-init");
11871188
return;

clang/test/KeyInstructions/init-agg.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// RUN: %clang -gkey-instructions %s -gmlt -gno-column-info -S -emit-llvm -o - \
2+
// RUN: %clang -gkey-instructions %s -gmlt -gno-column-info -S -emit-llvm -o - -ftrivial-auto-var-init=pattern \
33
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
44

55
// The implicit-check-not is important; we don't want the GEPs created for the
@@ -26,10 +26,14 @@ void a() {
2626

2727
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G4R1:!.*]]
2828
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, };
29+
30+
// CHECK: store i8 -86, ptr %uninit{{.*}}, !dbg [[G5R1:!.*]], !annotation
31+
char uninit; // -ftrivial-auto-var-init=pattern
2932
}
3033

3134
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
3235
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
3336
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
3437
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
3538
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
39+
// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)

0 commit comments

Comments
 (0)