[all-commits] [llvm/llvm-project] d732a3: [RemoveDIs] C API: Add before-dbg-record versions ...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Mon Jun 10 01:22:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d732a3298a70d83e5571c594de9be63df85668a7
      https://github.com/llvm/llvm-project/commit/d732a3298a70d83e5571c594de9be63df85668a7
  Author: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
  Date:   2024-06-10 (Mon, 10 Jun 2024)

  Changed paths:
    M llvm/bindings/ocaml/llvm/llvm.ml
    M llvm/bindings/ocaml/llvm/llvm.mli
    M llvm/bindings/ocaml/llvm/llvm_ocaml.c
    M llvm/docs/ReleaseNotes.rst
    M llvm/docs/RemoveDIsDebugInfo.md
    M llvm/include/llvm-c/Core.h
    M llvm/lib/IR/Core.cpp
    M llvm/test/Bindings/OCaml/core.ml
    M llvm/test/Bindings/llvm-c/debug_info.ll
    M llvm/test/Bindings/llvm-c/debug_info_new_format.ll
    M llvm/tools/llvm-c-test/debuginfo.c

  Log Message:
  -----------
  [RemoveDIs] C API: Add before-dbg-record versions of IRBuilder position funcs (#92417)

Add `LLVMPositionBuilderBeforeDbgRecords` and
`LLVMPositionBuilderBeforeInstrAndDbgRecords` to `llvm/include/llvm-c/Core.h`
which behave the same as `LLVMPositionBuilder` and `LVMPositionBuilderBefore`
except that the position is set before debug records attached to the target
instruction (the existing functions set the insertion point to after any
attached debug records).

More info on debug records and the migration towards using them can be found
here: https://llvm.org/docs/RemoveDIsDebugInfo.html

The distinction is important in some situations. An important example is when
inserting a phi before another instruction which has debug records attached to
it (these come "before" the instruction). Inserting before the instruction but
after the debug records would result in having debug records before a phi, which
is illegal. That results in an assertion failure:

`llvm/lib/IR/Instruction.cpp:166: Assertion '!isa<PHINode>(this) && "Inserting
PHI after debug-records!"' failed.`

In llvm (C++) we've added bit to instruction iterators that carries around the
extra information. Adding dedicated functions seemed like the least invasive and
least suprising way to update the C API.

Update llvm/tools/llvm-c-test/debuginfo.c to test this functionality.

Update the OCaml bindings, the migration docs and release notes.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list