aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-06-04 15:43:49 +0100
committerGitHub <noreply@github.com>2025-06-04 15:43:49 +0100
commit54d544b83141dc0b20727673f68793728ed54793 (patch)
tree4d97368d0571bd92eeffdab1cbe24c7496e88172 /clang/lib/CodeGen/CodeGenFunction.cpp
parenta7f0b29733ff5554703721e2e3b4b756b053b784 (diff)
downloadllvm-54d544b83141dc0b20727673f68793728ed54793.zip
llvm-54d544b83141dc0b20727673f68793728ed54793.tar.gz
llvm-54d544b83141dc0b20727673f68793728ed54793.tar.bz2
[KeyInstr][Clang] Ret atom (#134652)
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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 0388c67..2ac7e9d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -444,8 +444,10 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
// Reset the debug location to that of the simple 'return' expression, if any
// rather than that of the end of the function's scope '}'.
+ uint64_t RetKeyInstructionsAtomGroup = Loc ? Loc->getAtomGroup() : 0;
ApplyDebugLocation AL(*this, Loc);
- EmitFunctionEpilog(*CurFnInfo, EmitRetDbgLoc, EndLoc);
+ EmitFunctionEpilog(*CurFnInfo, EmitRetDbgLoc, EndLoc,
+ RetKeyInstructionsAtomGroup);
EmitEndEHSpec(CurCodeDecl);
assert(EHStack.empty() &&