Unverified Commit 47a2e732 authored by Jeremy Morse's avatar Jeremy Morse Committed by GitHub
Browse files

[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.
parent 3490f037
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment