[all-commits] [llvm/llvm-project] 47a2e7: [DebugInfo][RemoveDIs] Make getDbgValueRange inlin...
Jeremy Morse via All-commits
all-commits at lists.llvm.org
Thu Jan 25 05:13:59 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 47a2e732100c4102a1a5f3243123638f157c9a2a
https://github.com/llvm/llvm-project/commit/47a2e732100c4102a1a5f3243123638f157c9a2a
Author: Jeremy Morse <jeremy.morse at sony.com>
Date: 2024-01-25 (Thu, 25 Jan 2024)
Changed paths:
M llvm/include/llvm/IR/DebugProgramInstruction.h
M llvm/include/llvm/IR/Instruction.h
M llvm/lib/IR/Instruction.cpp
Log Message:
-----------
[DebugInfo][RemoveDIs] Make getDbgValueRange inlineable (#79331)
`getDbgValueRange` is the replacement of a common LLVM idiom of:
1) Am I currently looking at a `DbgVariableIntrinsic` instruction?
2) Let's do something special with it!
We instead iterate over the range of DPValues attached to an instruction
and do special things with those. Unfortunately in the common case of
"there is no debug-info", this generates a spurious function call that's
paid by non-debug builds.
To get around this, make `getDbgValueRange` inlineable so that the "`if
(DbgMarker)`" test can be inlined and guard the more expensive call. The
false path should be optimisable-awayable to skipping the loop. However,
due to header inclusion order we can't just make
`Instruction::getDbgValueRange` inline because `DPMarker` hasn't been
declared yet. So, define an inlinable function in the llvm:: namespace
and pre-declare it -- the eventual code should be inlineable almost 100%
of the time.
More information about the All-commits
mailing list