Skip to content

Commit 7c2a67e

Browse files
committed
[KeyInstr][Clang] Assign vector element atom
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. The Key Instructions project is introduced, including a "quick summary" section at the top which adds context for this PR, here: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668 The feature is only functional in LLVM if LLVM is built with CMake flag LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed. The Clang-side work is demoed here: #130943
1 parent 2ce3c5d commit 7c2a67e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,8 +2507,9 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
25072507
Vec = Builder.CreateBitCast(Vec, IRStoreTy);
25082508
}
25092509

2510-
Builder.CreateStore(Vec, Dst.getVectorAddress(),
2511-
Dst.isVolatileQualified());
2510+
auto *I = Builder.CreateStore(Vec, Dst.getVectorAddress(),
2511+
Dst.isVolatileQualified());
2512+
addInstToCurrentSourceAtom(I, Vec);
25122513
return;
25132514
}
25142515

clang/test/DebugInfo/KeyInstructions/agg.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
// RUN: %clang_cc1 -gkey-instructions -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - \
55
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
66

7+
__attribute__((ext_vector_type(1))) char c;
78
typedef struct { int a, b, c; } Struct;
89
void fun(Struct a) {
910
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G1R1:!.*]]
1011
Struct b = a;
1112

1213
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G2R1:!.*]]
1314
b = a;
15+
16+
// CHECK: %2 = load <1 x i8>, ptr @c
17+
// CHECK: %vecins = insertelement <1 x i8> %2, i8 0, i32 0, !dbg [[G3R2:!.*]]
18+
// CHECK: store <1 x i8> %vecins, ptr @c{{.*}}, !dbg [[G3R1:!.*]]
19+
c[0] = 0;
1420
}
1521

1622
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
1723
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
24+
// CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2)
25+
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)

0 commit comments

Comments
 (0)