[all-commits] [llvm/llvm-project] 7dc9d7: [DebugInfo][InstrRef] Handle llvm.frameaddress int...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Tue Jul 27 05:45:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7dc9d7373186827a92d6ca08ad7192208dfea389
      https://github.com/llvm/llvm-project/commit/7dc9d7373186827a92d6ca08ad7192208dfea389
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M llvm/lib/CodeGen/MachineFunction.cpp
    A llvm/test/DebugInfo/X86/instr-ref-framereg-read.ll

  Log Message:
  -----------
  [DebugInfo][InstrRef] Handle llvm.frameaddress intrinsics gracefully

When working out which instruction defines a value, the
instruction-referencing variable location code has a few special cases for
physical registers:
 * Arguments are never defined by instructions,
 * Constant physical registers always read the same value, are never def'd

This patch adds a third case for the llvm.frameaddress intrinsics: you can
read the framepointer in any block if you so choose, and use it as a
variable location, as shown in the added test.

This rather violates one of the assumptions behind instruction referencing,
that LLVM-ir shouldn't be able to read from an arbitrary register at some
arbitrary point in the program. The solution for now is to just emit a
DBG_PHI that reads the register value: this works, but if we wanted to do
something clever with DBG_PHIs in the future then this would probably get
in the way. As it stands, this patch avoids a crash.

Differential Revision: https://reviews.llvm.org/D106659




More information about the All-commits mailing list