
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. When returning a value, stores to the `retval` allocas and branches to `return` block are put in the same atom group. They are both rank 1, which could in theory introduce an extra step in some optimized code. This low risk currently feels an acceptable for keeping the code a bit simpler (as opposed to adding scaffolding to make the store rank 2). In the case of a single return (no control flow) the return instruction inherits the atom group of the branch to the return block when the blocks get folded togather. RFC: 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.
16 lines
668 B
C++
16 lines
668 B
C++
// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions %s -debug-info-kind=line-tables-only -emit-llvm -o -\
|
|
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
|
|
|
|
// CHECK: [[b_addr:@.*]] = {{.*}}global ptr
|
|
|
|
void g(int *a) {
|
|
// CHECK: [[v:%.*]] = load ptr, ptr %a.addr{{.*}}, !dbg [[G1R2:!.*]]
|
|
// CHECK: store ptr [[v]], ptr [[b_addr]]{{.*}}, !dbg [[G1R1:!.*]]
|
|
static int &b = *a;
|
|
// CHECK: ret{{.*}}, !dbg [[RET:!.*]]
|
|
}
|
|
|
|
// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
|
|
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
|
|
// CHECK: [[RET]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
|