aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-23 10:15:42 +0100
committerOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-23 13:46:37 +0100
commit123bf5f46c31a016768b7ecd9b164bde5ef881d9 (patch)
tree9ebf53c9cab3dd17b9558b7ca97d7ff1cfc9b562 /clang/lib/CodeGen/CodeGenFunction.cpp
parent760bf4f116f9a76ec9d19aeb83e567940ede4a46 (diff)
downloadllvm-123bf5f46c31a016768b7ecd9b164bde5ef881d9.zip
llvm-123bf5f46c31a016768b7ecd9b164bde5ef881d9.tar.gz
llvm-123bf5f46c31a016768b7ecd9b164bde5ef881d9.tar.bz2
[KeyInstr][Clang] If stmt atom (#134642)
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. 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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 2256cc0..0356952 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -2118,6 +2118,8 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
llvm::Instruction *BrInst = Builder.CreateCondBr(CondV, TrueBlock, FalseBlock,
Weights, Unpredictable);
+ addInstToNewSourceAtom(BrInst, CondV);
+
switch (HLSLControlFlowAttr) {
case HLSLControlFlowHintAttr::Microsoft_branch:
case HLSLControlFlowHintAttr::Microsoft_flatten: {
@@ -3338,3 +3340,11 @@ void CodeGenFunction::addInstToSpecificSourceAtom(
if (CGDebugInfo *DI = getDebugInfo())
DI->addInstToSpecificSourceAtom(KeyInstruction, Backup, Atom);
}
+
+void CodeGenFunction::addInstToNewSourceAtom(llvm::Instruction *KeyInstruction,
+ llvm::Value *Backup) {
+ if (CGDebugInfo *DI = getDebugInfo()) {
+ ApplyAtomGroup Grp(getDebugInfo());
+ DI->addInstToCurrentSourceAtom(KeyInstruction, Backup);
+ }
+} \ No newline at end of file