mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 07:06:38 +00:00
[KeyInstr][Clang] Assignment atom group
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: https://github.com/llvm/llvm-project/pull/130943
This commit is contained in:
parent
a92afbf589
commit
cdf3eef4a2
@ -5814,6 +5814,15 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
|
||||
|
||||
assert(E->getOpcode() == BO_Assign && "unexpected binary l-value");
|
||||
|
||||
// This covers both LHS and RHS expressions, though nested RHS
|
||||
// expressions may get subsequently separately grouped.
|
||||
// FIXME(OCH): Not clear yet if we've got fine enough control
|
||||
// to pick and choose when we need to. Currently looks ok:
|
||||
// a = b = c -> Two atoms.
|
||||
// x = new(1) -> One atom (for both addr store and value store).
|
||||
// Complex and agg assignment -> One atom.
|
||||
ApplyAtomGroup Grp(getDebugInfo());
|
||||
|
||||
// Note that in all of these cases, __block variables need the RHS
|
||||
// evaluated first just in case the variable gets moved by the RHS.
|
||||
|
||||
|
9
clang/test/KeyInstructions/assign.cpp
Normal file
9
clang/test/KeyInstructions/assign.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// RUN: %clang -gkey-instructions %s -gmlt -gcolumn-info -S -emit-llvm -o - -Wno-unused-variable \
|
||||
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
|
||||
|
||||
unsigned long long g;
|
||||
void fun() { g = 0; }
|
||||
|
||||
// CHECK: store i64 0, ptr @g{{.*}}, !dbg [[G1R1:!.*]]
|
||||
|
||||
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
|
Loading…
x
Reference in New Issue
Block a user