Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c64f3e7

Browse filesBrowse files
committed
[KeyInstr][Clang] Scalar init 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 138a899 commit c64f3e7
Copy full SHA for c64f3e7

File tree

Expand file treeCollapse file tree

3 files changed

+22
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+22
-0
lines changed

‎clang/lib/CodeGen/CGDecl.cpp

Copy file name to clipboardExpand all lines: clang/lib/CodeGen/CGDecl.cpp
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
19251925

19261926
const VarDecl &D = *emission.Variable;
19271927
auto DL = ApplyDebugLocation::CreateDefaultArtificial(*this, D.getLocation());
1928+
ApplyAtomGroup Grp(getDebugInfo());
19281929
QualType type = D.getType();
19291930

19301931
// If this local has an initializer, emit it now.

‎clang/lib/CodeGen/CGExpr.cpp

Copy file name to clipboardExpand all lines: clang/lib/CodeGen/CGExpr.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,8 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
22222222
}
22232223

22242224
llvm::StoreInst *Store = Builder.CreateStore(Value, Addr, Volatile);
2225+
addInstToCurrentSourceAtom(Store, Value);
2226+
22252227
if (isNontemporal) {
22262228
llvm::MDNode *Node =
22272229
llvm::MDNode::get(Store->getContext(),
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %clang -gkey-instructions -x c++ %s -gmlt -gcolumn-info -S -emit-llvm -o - \
2+
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
3+
4+
// RUN: %clang -gkey-instructions -x c %s -gmlt -gcolumn-info -S -emit-llvm -o - \
5+
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
6+
7+
void a() {
8+
// CHECK: store i32 0, ptr %A{{.*}}, !dbg [[G1R1:!.*]]
9+
int A = 0;
10+
// CHECK: %add = add {{.*}}, !dbg [[G2R2:!.*]]
11+
// CHECK: store i32 %add, ptr %B, align 4, !dbg [[G2R1:!.*]]
12+
int B = 2 * A + 1;
13+
// CHECK-TODO: ret{{.*}}, !dbg [[G3R1:!.*]]
14+
}
15+
16+
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
17+
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
18+
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
19+
// CHECK-TODO: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.