diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2025-05-06 11:42:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-06 11:42:50 +0100 |
commit | 43a9d5dfd52d3845596d20b62159147cd276d343 (patch) | |
tree | c0d97653e3b5e0268d976d90c434a6755dc09090 /llvm/lib/IR/LLVMContext.cpp | |
parent | 0159a26744dd3ca332973c0e1cd8f6ccbace2927 (diff) | |
download | llvm-43a9d5dfd52d3845596d20b62159147cd276d343.zip llvm-43a9d5dfd52d3845596d20b62159147cd276d343.tar.gz llvm-43a9d5dfd52d3845596d20b62159147cd276d343.tar.bz2 |
[KeyInstr] Add Atom Group waterline to LLVMContext (#133478)
Source location atoms are identified by a function-local number and the
DILocation's InlinedAt field. The front end is responsible for assigning source
atom numbers, but certain optimisations need to assign new atom numbers to some
instructions. Most often code duplication optimisations like loop
unroll. Tracking a global maximum value (waterline) means we can easily
(cheaply) get new numbers that don't clash in any function.
The waterline is managed through DILocation creation,
LLVMContext::incNextAtomGroup, and LLVMContext::updateAtomGroupWaterline.
Add unittest.
RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 447e5d9..57532cd 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -377,3 +377,11 @@ StringRef LLVMContext::getDefaultTargetFeatures() { void LLVMContext::setDefaultTargetFeatures(StringRef Features) { pImpl->DefaultTargetFeatures = Features; } + +void LLVMContext::updateDILocationAtomGroupWaterline(uint64_t V) { + pImpl->NextAtomGroup = std::max(pImpl->NextAtomGroup, V); +} + +uint64_t LLVMContext::incNextDILocationAtomGroup() { + return pImpl->NextAtomGroup++; +} |