[llvm] [RemoveDIs] Update DIBuilder C API with DbgRecord functions. (PR #95535)

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 05:27:43 PDT 2024


https://github.com/CarlosAlbertoEnciso updated https://github.com/llvm/llvm-project/pull/95535

>From b40d1e89d7f2ddb99e1a7276b8eae1d0b04258d7 Mon Sep 17 00:00:00 2001
From: Carlos Alberto Enciso <Carlos.Enciso at sony.com>
Date: Fri, 14 Jun 2024 13:01:36 +0100
Subject: [PATCH 1/4] [RemoveDIs] Update DIBuilder C API with DbgRecord
 functions.

https://github.com/llvm/llvm-project/pull/84915
https://github.com/llvm/llvm-project/pull/85657
https://github.com/llvm/llvm-project/pull/92417#issuecomment-2120078326

As discussed by @nikic and @OCHyams:

https://github.com/llvm/llvm-project/pull/92417#issuecomment-2144505440

> For the intrinsic-inserting functions, do you think we should:
>
> a) mark as deprecated but otherwise leave them alone for now.
> b) mark as deprecated and change their behaviour so that they
>    do nothing and return nullptr.
> c) outright delete them (it sounds like you're voting this one,
>    but just wanted to double check).

This patch implements option (c).
---
 .../ocaml/debuginfo/debuginfo_ocaml.c         |  39 -----
 .../ocaml/debuginfo/llvm_debuginfo.ml         |  20 ---
 .../ocaml/debuginfo/llvm_debuginfo.mli        |  24 ---
 llvm/docs/ReleaseNotes.rst                    |  38 ++++-
 llvm/docs/RemoveDIsDebugInfo.md               |  32 ++--
 llvm/include/llvm-c/DebugInfo.h               | 142 ------------------
 llvm/lib/IR/DebugInfo.cpp                     |  87 -----------
 llvm/test/Bindings/llvm-c/debug_info.ll       |  76 ----------
 .../Bindings/llvm-c/debug_info_new_format.ll  |  11 +-
 llvm/tools/llvm-c-test/debuginfo.c            |  41 +----
 llvm/tools/llvm-c-test/llvm-c-test.h          |   2 +-
 llvm/tools/llvm-c-test/main.c                 |   7 +-
 12 files changed, 69 insertions(+), 450 deletions(-)
 delete mode 100644 llvm/test/Bindings/llvm-c/debug_info.ll

diff --git a/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c b/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
index fbe45c0c1e0b0..fd99724ca0559 100644
--- a/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
+++ b/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
@@ -969,45 +969,6 @@ value llvm_dibuild_create_parameter_variable_bytecode(value *argv, int arg) {
   );
 }
 
-value llvm_dibuild_insert_declare_before_native(value Builder, value Storage,
-                                                value VarInfo, value Expr,
-                                                value DebugLoc, value Instr) {
-  LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareBefore(
-      DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
-      Metadata_val(Expr), Metadata_val(DebugLoc), Value_val(Instr));
-  return to_val(Value);
-}
-
-value llvm_dibuild_insert_declare_before_bytecode(value *argv, int arg) {
-
-  return llvm_dibuild_insert_declare_before_native(argv[0], // Builder
-                                                   argv[1], // Storage
-                                                   argv[2], // VarInfo
-                                                   argv[3], // Expr
-                                                   argv[4], // DebugLoc
-                                                   argv[5]  // Instr
-  );
-}
-
-value llvm_dibuild_insert_declare_at_end_native(value Builder, value Storage,
-                                                value VarInfo, value Expr,
-                                                value DebugLoc, value Block) {
-  LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareAtEnd(
-      DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
-      Metadata_val(Expr), Metadata_val(DebugLoc), BasicBlock_val(Block));
-  return to_val(Value);
-}
-
-value llvm_dibuild_insert_declare_at_end_bytecode(value *argv, int arg) {
-  return llvm_dibuild_insert_declare_at_end_native(argv[0], // Builder
-                                                   argv[1], // Storage
-                                                   argv[2], // VarInfo
-                                                   argv[3], // Expr
-                                                   argv[4], // DebugLoc
-                                                   argv[5]  // Block
-  );
-}
-
 value llvm_dibuild_expression(value Builder, value Addr) {
   return to_val(LLVMDIBuilderCreateExpression(
       DIBuilder_val(Builder), (uint64_t *)Op_val(Addr), Wosize_val(Addr)));
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
index 8bb5edb17a2c9..3098b28120cc0 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
@@ -592,26 +592,6 @@ external dibuild_create_parameter_variable :
   Llvm.llmetadata
   = "llvm_dibuild_create_parameter_variable_bytecode" "llvm_dibuild_create_parameter_variable_native"
 
-external dibuild_insert_declare_before :
-  lldibuilder ->
-  storage:Llvm.llvalue ->
-  var_info:Llvm.llmetadata ->
-  expr:Llvm.llmetadata ->
-  location:Llvm.llmetadata ->
-  instr:Llvm.llvalue ->
-  Llvm.lldbgrecord
-  = "llvm_dibuild_insert_declare_before_bytecode" "llvm_dibuild_insert_declare_before_native"
-
-external dibuild_insert_declare_at_end :
-  lldibuilder ->
-  storage:Llvm.llvalue ->
-  var_info:Llvm.llmetadata ->
-  expr:Llvm.llmetadata ->
-  location:Llvm.llmetadata ->
-  block:Llvm.llbasicblock ->
-  Llvm.lldbgrecord
-  = "llvm_dibuild_insert_declare_at_end_bytecode" "llvm_dibuild_insert_declare_at_end_native"
-
 external dibuild_expression :
   lldibuilder ->
   Int64.t array ->
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
index 7c7882ccce855..e3ee209a2ee2b 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
@@ -652,30 +652,6 @@ val dibuild_create_parameter_variable :
 (** [dibuild_create_parameter_variable] Create a new descriptor for a
     function parameter variable. *)
 
-val dibuild_insert_declare_before :
-  lldibuilder ->
-  storage:Llvm.llvalue ->
-  var_info:Llvm.llmetadata ->
-  expr:Llvm.llmetadata ->
-  location:Llvm.llmetadata ->
-  instr:Llvm.llvalue ->
-  Llvm.lldbgrecord
-(** [dibuild_insert_declare_before]  Insert a new llvm.dbg.declare
-    intrinsic call before the given instruction [instr]. *)
-
-val dibuild_insert_declare_at_end :
-  lldibuilder ->
-  storage:Llvm.llvalue ->
-  var_info:Llvm.llmetadata ->
-  expr:Llvm.llmetadata ->
-  location:Llvm.llmetadata ->
-  block:Llvm.llbasicblock ->
-  Llvm.lldbgrecord
-(** [dibuild_insert_declare_at_end] Insert a new llvm.dbg.declare
-    intrinsic call at the end of basic block [block]. If [block]
-    has a terminator instruction, the intrinsic is inserted
-    before that terminator instruction. *)
-
 val dibuild_expression : lldibuilder -> Int64.t array -> Llvm.llmetadata
 (** [dibuild_expression] Create a new descriptor for the specified variable
     which has a complex address expression for its address.
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 5fdbc9f349af4..56417e570fdb7 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -220,7 +220,43 @@ Changes to the C API
   * ``LLVMConstICmp``
   * ``LLVMConstFCmp``
 
-* Added ``LLVMPositionBuilderBeforeDbgRecords`` and ``LLVMPositionBuilderBeforeInstrAndDbgRecords``. Same as ``LLVMPositionBuilder`` and ``LLVMPositionBuilderBefore`` except the insertion position is set to before the debug records that precede the target instruction. See the `debug info migration guide <https://llvm.org/docs/RemoveDIsDebugInfo.html>`_ for more info. ``LLVMPositionBuilder`` and ``LLVMPositionBuilderBefore`` are unchanged; they insert before the indicated instruction but after any attached debug records.
+* Added the following functions to insert before the indicated instruction but
+  after any attached debug records.
+
+  * ``LLVMPositionBuilderBeforeDbgRecords``
+  * ``LLVMPositionBuilderBeforeInstrAndDbgRecords``
+
+  Same as ``LLVMPositionBuilder`` and ``LLVMPositionBuilderBefore`` except the
+  insertion position is set to before the debug records that precede the target
+  instruction. ``LLVMPositionBuilder`` and ``LLVMPositionBuilderBefore`` are
+  unchanged.
+
+  See the `debug info migration guide <https://llvm.org/docs/RemoveDIsDebugInfo.html>`_ for more info.
+
+* Added the following functions to get/set the new non-instruction debug info format.
+
+  * ``LLVMIsNewDbgInfoFormat``
+  * ``LLVMSetIsNewDbgInfoFormat``
+
+* Added the following functions (no plans to deprecate) to insert a debug record
+  (new debug info format).
+
+  * ``LLVMDIBuilderInsertDeclareRecordBefore``
+  * ``LLVMDIBuilderInsertDeclareRecordAtEnd``
+  * ``LLVMDIBuilderInsertDbgValueRecordBefore``
+  * ``LLVMDIBuilderInsertDbgValueRecordAtEnd``
+
+* Deleted the following functions that inserted a debug intrinsic (old debug info format)
+
+  * ``LLVMDIBuilderInsertDeclareBefore``
+  * ``LLVMDIBuilderInsertDeclareAtEnd``
+  * ``LLVMDIBuilderInsertDbgValueBefore``
+  * ``LLVMDIBuilderInsertDbgValueAtEnd``
+
+  * ``LLVMDIBuilderInsertDeclareIntrinsicBefore``
+  * ``LLVMDIBuilderInsertDeclareIntrinsicAtEnd``
+  * ``LLVMDIBuilderInsertDbgValueIntrinsicBefore``
+  * ``LLVMDIBuilderInsertDbgValueIntrinsicAtEnd``
 
 Changes to the CodeGen infrastructure
 -------------------------------------
diff --git a/llvm/docs/RemoveDIsDebugInfo.md b/llvm/docs/RemoveDIsDebugInfo.md
index 56634f7ccc6bd..b71143e991282 100644
--- a/llvm/docs/RemoveDIsDebugInfo.md
+++ b/llvm/docs/RemoveDIsDebugInfo.md
@@ -140,34 +140,36 @@ Any tests downstream of the main LLVM repo that test the IR output of LLVM may b
 Some new functions that have been added are temporary and will be deprecated in the future. The intention is that they'll help downstream projects adapt during the transition period.
 
 ```
-New functions (all to be deprecated)
-------------------------------------
-LLVMIsNewDbgInfoFormat                      # Returns true if the module is in the new non-instruction mode.
-LLVMSetIsNewDbgInfoFormat                   # Convert to the requested debug info format.
+Deleted functions
+-----------------
+LLVMDIBuilderInsertDeclareBefore   # Insert a debug record (new debug info format) instead of a debug intrinsic (old debug info format).
+LLVMDIBuilderInsertDeclareAtEnd    # Same as above.
+LLVMDIBuilderInsertDbgValueBefore  # Same as above.
+LLVMDIBuilderInsertDbgValueAtEnd   # Same as above.
 
 LLVMDIBuilderInsertDeclareIntrinsicBefore   # Insert a debug intrinsic (old debug info format).
 LLVMDIBuilderInsertDeclareIntrinsicAtEnd    # Same as above.
 LLVMDIBuilderInsertDbgValueIntrinsicBefore  # Same as above.
 LLVMDIBuilderInsertDbgValueIntrinsicAtEnd   # Same as above.
 
-LLVMDIBuilderInsertDeclareRecordBefore      # Insert a debug record (new debug info format).
-LLVMDIBuilderInsertDeclareRecordAtEnd       # Same as above.
-LLVMDIBuilderInsertDbgValueRecordBefore     # Same as above.
-LLVMDIBuilderInsertDbgValueRecordAtEnd      # Same as above.
+New functions (to be deprecated)
+--------------------------------
+LLVMIsNewDbgInfoFormat     # Returns true if the module is in the new non-instruction mode.
+LLVMSetIsNewDbgInfoFormat  # Convert to the requested debug info format.
 
-Existing functions (behaviour change)
+New functions (no plans to deprecate)
 -------------------------------------
-LLVMDIBuilderInsertDeclareBefore   # Insert a debug record (new debug info format) instead of a debug intrinsic (old debug info format).
-LLVMDIBuilderInsertDeclareAtEnd    # Same as above.
-LLVMDIBuilderInsertDbgValueBefore  # Same as above.
-LLVMDIBuilderInsertDbgValueAtEnd   # Same as above.
+LLVMDIBuilderInsertDeclareRecordBefore   # Insert a debug record (new debug info format).
+LLVMDIBuilderInsertDeclareRecordAtEnd    # Same as above. See info below.
+LLVMDIBuilderInsertDbgValueRecordBefore  # Same as above. See info below.
+LLVMDIBuilderInsertDbgValueRecordAtEnd   # Same as above. See info below.
 
-New functions (no plans to deprecate)
-----------------------------------
 LLVMPositionBuilderBeforeDbgRecords          # See info below.
 LLVMPositionBuilderBeforeInstrAndDbgRecords  # See info below.
 ```
 
+`LLVMDIBuilderInsertDeclareRecordBefore`, `LLVMDIBuilderInsertDeclareRecordAtEnd`, `LLVMDIBuilderInsertDbgValueRecordBefore` and `LLVMDIBuilderInsertDbgValueRecordAtEnd` are replacing the deleted `LLVMDIBuilderInsertDeclareBefore-style` functions.
+
 `LLVMPositionBuilderBeforeDbgRecords` and `LLVMPositionBuilderBeforeInstrAndDbgRecords` behave the same as `LLVMPositionBuilder` and `LLVMPositionBuilderBefore` except the insertion position is set before the debug records that precede the target instruction. Note that this doesn't mean that debug intrinsics before the chosen instruction are skipped, only debug records (which unlike debug records are not themselves instructions).
 
 If you don't know which function to call then follow this rule:
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 2c3c75e246c00..81a888c0f4d91 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -1261,40 +1261,6 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
     unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
     LLVMMetadataRef Decl, uint32_t AlignInBits);
 
-/*
- * Insert a new Declare DbgRecord before the given instruction.
- *
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
- * Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * \param Builder     The DIBuilder.
- * \param Storage     The storage of the variable to declare.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Instr       Instruction acting as a location for the new intrinsic.
- */
-LLVMDbgRecordRef
-LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
-                                 LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
-                                 LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
-/**
- * Soon to be deprecated.
- * Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
- * \param Builder     The DIBuilder.
- * \param Storage     The storage of the variable to declare.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Instr       Instruction acting as a location for the new intrinsic.
- */
-LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
-    LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 /**
  * Soon to be deprecated.
  * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
@@ -1312,43 +1278,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
     LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 
-/**
- * Insert a new Declare DbgRecord at the end of the given basic block. If the
- * basic block has a terminator instruction, the intrinsic is inserted before
- * that terminator instruction.
- *
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
- * Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * \param Builder     The DIBuilder.
- * \param Storage     The storage of the variable to declare.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Block       Basic block acting as a location for the new intrinsic.
- */
-LLVMDbgRecordRef LLVMDIBuilderInsertDeclareAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
-/**
- * Soon to be deprecated.
- * Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
- * block. If the basic block has a terminator instruction, the intrinsic is
- * inserted before that terminator instruction.
- * \param Builder     The DIBuilder.
- * \param Storage     The storage of the variable to declare.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Block       Basic block acting as a location for the new intrinsic.
- */
-LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
 /**
  * Soon to be deprecated.
  * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
@@ -1368,40 +1297,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
     LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
 
-/**
- * Insert a new Value DbgRecord before the given instruction.
- *
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
- * Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * \param Builder     The DIBuilder.
- * \param Val         The value of the variable.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Instr       Instruction acting as a location for the new intrinsic.
- */
-LLVMDbgRecordRef
-LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder, LLVMValueRef Val,
-                                  LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
-                                  LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
-/**
- * Soon to be deprecated.
- * Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * Insert a new llvm.dbg.value intrinsic call before the given instruction.
- * \param Builder     The DIBuilder.
- * \param Val         The value of the variable.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Instr       Instruction acting as a location for the new intrinsic.
- */
-LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 /**
  * Soon to be deprecated.
  * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
@@ -1419,43 +1314,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
     LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 
-/**
- * Insert a new Value DbgRecord at the end of the given basic block. If the
- * basic block has a terminator instruction, the intrinsic is inserted before
- * that terminator instruction.
- *
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
- * Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * \param Builder     The DIBuilder.
- * \param Val         The value of the variable.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Block       Basic block acting as a location for the new intrinsic.
- */
-LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
-/**
- * Soon to be deprecated.
- * Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
- * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
- *
- * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
- * block. If the basic block has a terminator instruction, the intrinsic is
- * inserted before that terminator instruction.
- * \param Builder     The DIBuilder.
- * \param Val         The value of the variable.
- * \param VarInfo     The variable's debug info descriptor.
- * \param Expr        A complex location expression for the variable.
- * \param DebugLoc    Debug info location.
- * \param Block       Basic block acting as a location for the new intrinsic.
- */
-LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
 /**
  * Soon to be deprecated.
  * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 228e17641ffc4..e57c3fe8c825d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1662,29 +1662,6 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
       unwrapDI<MDNode>(Decl), nullptr, AlignInBits));
 }
 
-LLVMDbgRecordRef
-LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
-                                 LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
-                                 LLVMMetadataRef DL, LLVMValueRef Instr) {
-  return LLVMDIBuilderInsertDeclareRecordBefore(Builder, Storage, VarInfo, Expr,
-                                                DL, Instr);
-}
-LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
-    LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
-  DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
-      unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
-      unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
-      unwrap<Instruction>(Instr));
-  // This assert will fail if the module is in the new debug info format.
-  // This function should only be called if the module is in the old
-  // debug info format.
-  // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
-  // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
-  assert(isa<Instruction *>(DbgInst) &&
-         "Function unexpectedly in new debug info format");
-  return wrap(cast<Instruction *>(DbgInst));
-}
 LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
     LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
@@ -1702,28 +1679,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
   return wrap(cast<DbgRecord *>(DbgInst));
 }
 
-LLVMDbgRecordRef
-LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
-                                LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
-                                LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
-  return LLVMDIBuilderInsertDeclareRecordAtEnd(Builder, Storage, VarInfo, Expr,
-                                               DL, Block);
-}
-LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
-  DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
-      unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
-      unwrap<DIExpression>(Expr), unwrap<DILocation>(DL), unwrap(Block));
-  // This assert will fail if the module is in the new debug info format.
-  // This function should only be called if the module is in the old
-  // debug info format.
-  // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
-  // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
-  assert(isa<Instruction *>(DbgInst) &&
-         "Function unexpectedly in new debug info format");
-  return wrap(cast<Instruction *>(DbgInst));
-}
 LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
     LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
@@ -1740,27 +1695,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
   return wrap(cast<DbgRecord *>(DbgInst));
 }
 
-LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueBefore(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
-  return LLVMDIBuilderInsertDbgValueRecordBefore(Builder, Val, VarInfo, Expr,
-                                                 DebugLoc, Instr);
-}
-LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
-  DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
-      unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
-      unwrap<DILocation>(DebugLoc), unwrap<Instruction>(Instr));
-  // This assert will fail if the module is in the new debug info format.
-  // This function should only be called if the module is in the old
-  // debug info format.
-  // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
-  // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
-  assert(isa<Instruction *>(DbgInst) &&
-         "Function unexpectedly in new debug info format");
-  return wrap(cast<Instruction *>(DbgInst));
-}
 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
     LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
@@ -1777,27 +1711,6 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
   return wrap(cast<DbgRecord *>(DbgInst));
 }
 
-LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
-  return LLVMDIBuilderInsertDbgValueRecordAtEnd(Builder, Val, VarInfo, Expr,
-                                                DebugLoc, Block);
-}
-LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
-    LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
-    LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
-  DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
-      unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
-      unwrap<DILocation>(DebugLoc), unwrap(Block));
-  // This assert will fail if the module is in the new debug info format.
-  // This function should only be called if the module is in the old
-  // debug info format.
-  // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
-  // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
-  assert(isa<Instruction *>(DbgInst) &&
-         "Function unexpectedly in new debug info format");
-  return wrap(cast<Instruction *>(DbgInst));
-}
 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(
     LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
diff --git a/llvm/test/Bindings/llvm-c/debug_info.ll b/llvm/test/Bindings/llvm-c/debug_info.ll
deleted file mode 100644
index 71986fbb2348f..0000000000000
--- a/llvm/test/Bindings/llvm-c/debug_info.ll
+++ /dev/null
@@ -1,76 +0,0 @@
-; RUN: llvm-c-test --test-dibuilder-old-debuginfo-format | FileCheck %s
-
-; CHECK: ; ModuleID = 'debuginfo.c'
-; CHECK-NEXT: source_filename = "debuginfo.c"
-
-; CHECK:      define i64 @foo(i64 %0, i64 %1, <10 x i64> %2) !dbg !31 {
-; CHECK-NEXT: entry:
-; CHECK-NEXT:   call void @llvm.dbg.declare(metadata i64 0, metadata !38, metadata !DIExpression()), !dbg !43
-; CHECK-NEXT:   call void @llvm.dbg.declare(metadata i64 0, metadata !39, metadata !DIExpression()), !dbg !43
-; CHECK-NEXT:   call void @llvm.dbg.declare(metadata i64 0, metadata !40, metadata !DIExpression()), !dbg !43
-; CHECK-NEXT:   br label %vars
-; CHECK:      vars:
-; CHECK-NEXT:   %p1 = phi i64 [ 0, %entry ]
-; CHECK-NEXT:   %p2 = phi i64 [ 0, %entry ]
-; CHECK-NEXT:   call void @llvm.dbg.value(metadata i64 0, metadata !41, metadata !DIExpression(DW_OP_constu, 0, DW_OP_stack_value)), !dbg !44
-; CHECK-NEXT:   %a = add i64 %p1, %p2
-; CHECK-NEXT:   ret i64 0
-; CHECK-NEXT: }
-
-; CHECK:      ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
-; CHECK-NEXT: declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
-
-; CHECK:      ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
-; CHECK-NEXT: declare void @llvm.dbg.value(metadata, metadata, metadata) #0
-
-; CHECK:      attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
-
-; CHECK:      !llvm.dbg.cu = !{!0}
-; CHECK-NEXT: !FooType = !{!28}
-; CHECK-NEXT: !EnumTest = !{!3}
-
-; CHECK:      !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "llvm-c-test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !11, imports: !19, macros: !23, splitDebugInlining: false, sysroot: "/")
-; CHECK-NEXT: !1 = !DIFile(filename: "debuginfo.c", directory: ".")
-; CHECK-NEXT: !2 = !{!3}
-; CHECK-NEXT: !3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EnumTest", scope: !4, file: !1, baseType: !6, size: 64, elements: !7)
-; CHECK-NEXT: !4 = !DINamespace(name: "NameSpace", scope: !5)
-; CHECK-NEXT: !5 = !DIModule(scope: null, name: "llvm-c-test", includePath: "/test/include/llvm-c-test.h")
-; CHECK-NEXT: !6 = !DIBasicType(name: "Int64", size: 64)
-; CHECK-NEXT: !7 = !{!8, !9, !10}
-; CHECK-NEXT: !8 = !DIEnumerator(name: "Test_A", value: 0, isUnsigned: true)
-; CHECK-NEXT: !9 = !DIEnumerator(name: "Test_B", value: 1, isUnsigned: true)
-; CHECK-NEXT: !10 = !DIEnumerator(name: "Test_B", value: 2, isUnsigned: true)
-; CHECK-NEXT: !11 = !{!12, !16}
-; CHECK-NEXT: !12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value))
-; CHECK-NEXT: !13 = distinct !DIGlobalVariable(name: "globalClass", scope: !5, file: !1, line: 1, type: !14, isLocal: true, isDefinition: true)
-; CHECK-NEXT: !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "TestClass", scope: !1, file: !1, line: 42, size: 64, flags: DIFlagObjcClassComplete, elements: !15)
-; CHECK-NEXT: !15 = !{}
-; CHECK-NEXT: !16 = !DIGlobalVariableExpression(var: !17, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value))
-; CHECK-NEXT: !17 = distinct !DIGlobalVariable(name: "global", scope: !5, file: !1, line: 1, type: !18, isLocal: true, isDefinition: true)
-; CHECK-NEXT: !18 = !DIDerivedType(tag: DW_TAG_typedef, name: "int64_t", scope: !1, file: !1, line: 42, baseType: !6)
-; CHECK-NEXT: !19 = !{!20, !22}
-; CHECK-NEXT: !20 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !5, entity: !21, file: !1, line: 42)
-; CHECK-NEXT: !21 = !DIModule(scope: null, name: "llvm-c-test-import", includePath: "/test/include/llvm-c-test-import.h")
-; CHECK-NEXT: !22 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !5, entity: !20, file: !1, line: 42)
-; CHECK-NEXT: !23 = !{!24}
-; CHECK-NEXT: !24 = !DIMacroFile(file: !1, nodes: !25)
-; CHECK-NEXT: !25 = !{!26, !27}
-; CHECK-NEXT: !26 = !DIMacro(type: DW_MACINFO_define, name: "SIMPLE_DEFINE")
-; CHECK-NEXT: !27 = !DIMacro(type: DW_MACINFO_define, name: "VALUE_DEFINE", value: "1")
-; CHECK-NEXT: !28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !29, size: 192, dwarfAddressSpace: 0)
-; CHECK-NEXT: !29 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyStruct", scope: !4, file: !1, size: 192, elements: !30, runtimeLang: DW_LANG_C89, identifier: "MyStruct")
-; CHECK-NEXT: !30 = !{!6, !6, !6}
-; CHECK-NEXT: !31 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 42, type: !32, scopeLine: 42, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !37)
-; CHECK-NEXT: !32 = !DISubroutineType(types: !33)
-; CHECK-NEXT: !33 = !{!6, !6, !34}
-; CHECK-NEXT: !34 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 640, flags: DIFlagVector, elements: !35)
-; CHECK-NEXT: !35 = !{!36}
-; CHECK-NEXT: !36 = !DISubrange(count: 10, lowerBound: 0)
-; CHECK-NEXT: !37 = !{!38, !39, !40, !41}
-; CHECK-NEXT: !38 = !DILocalVariable(name: "a", arg: 1, scope: !31, file: !1, line: 42, type: !6)
-; CHECK-NEXT: !39 = !DILocalVariable(name: "b", arg: 2, scope: !31, file: !1, line: 42, type: !6)
-; CHECK-NEXT: !40 = !DILocalVariable(name: "c", arg: 3, scope: !31, file: !1, line: 42, type: !34)
-; CHECK-NEXT: !41 = !DILocalVariable(name: "d", scope: !42, file: !1, line: 43, type: !6)
-; CHECK-NEXT: !42 = distinct !DILexicalBlock(scope: !31, file: !1, line: 42)
-; CHECK-NEXT: !43 = !DILocation(line: 42, scope: !31)
-; CHECK-NEXT: !44 = !DILocation(line: 43, scope: !31)
diff --git a/llvm/test/Bindings/llvm-c/debug_info_new_format.ll b/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
index 1b6f2c4ea403a..3e654afef3592 100644
--- a/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
+++ b/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-c-test --test-dibuilder-new-debuginfo-format | FileCheck %s
+; RUN: llvm-c-test --test-dibuilder-debuginfo-format | FileCheck %s
 ;; Duplicate of debug_info.ll using debug records instead of intrinsics.
 
 ; CHECK: ; ModuleID = 'debuginfo.c'
@@ -6,14 +6,12 @@
 
 ; CHECK:      define i64 @foo(i64 %0, i64 %1, <10 x i64> %2) !dbg !31 {
 ; CHECK-NEXT: entry:
-; CHECK-NEXT:     #dbg_declare(i64 0, !38, !DIExpression(), !43)
-; CHECK-NEXT:     #dbg_declare(i64 0, !39, !DIExpression(), !43)
-; CHECK-NEXT:     #dbg_declare(i64 0, !40, !DIExpression(), !43)
 ; CHECK-NEXT:   br label %vars
+
 ; CHECK:      vars:
 ; CHECK-NEXT:   %p1 = phi i64 [ 0, %entry ]
 ; CHECK-NEXT:   %p2 = phi i64 [ 0, %entry ]
-; CHECK-NEXT:     #dbg_value(i64 0, !41, !DIExpression(DW_OP_constu, 0, DW_OP_stack_value), !44)
+; CHECK-NEXT:     #dbg_value(i64 0, !41, !DIExpression(DW_OP_constu, 0, DW_OP_stack_value), !43)
 ; CHECK-NEXT:   %a = add i64 %p1, %p2
 ; CHECK-NEXT:   ret i64 0
 ; CHECK-NEXT: }
@@ -65,5 +63,4 @@
 ; CHECK-NEXT: !40 = !DILocalVariable(name: "c", arg: 3, scope: !31, file: !1, line: 42, type: !34)
 ; CHECK-NEXT: !41 = !DILocalVariable(name: "d", scope: !42, file: !1, line: 43, type: !6)
 ; CHECK-NEXT: !42 = distinct !DILexicalBlock(scope: !31, file: !1, line: 42)
-; CHECK-NEXT: !43 = !DILocation(line: 42, scope: !31)
-; CHECK-NEXT: !44 = !DILocation(line: 43, scope: !31)
+; CHECK-NEXT: !43 = !DILocation(line: 43, scope: !31)
diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c
index 032657203b5f2..d7c8d2bb55269 100644
--- a/llvm/tools/llvm-c-test/debuginfo.c
+++ b/llvm/tools/llvm-c-test/debuginfo.c
@@ -29,10 +29,13 @@ declare_objc_class(LLVMDIBuilderRef DIB, LLVMMetadataRef File) {
   return Decl;
 }
 
-int llvm_test_dibuilder(bool NewDebugInfoFormat) {
+int llvm_test_dibuilder() {
   const char *Filename = "debuginfo.c";
   LLVMModuleRef M = LLVMModuleCreateWithName(Filename);
-  LLVMSetIsNewDbgInfoFormat(M, NewDebugInfoFormat);
+
+  LLVMSetIsNewDbgInfoFormat(M, true);
+  assert(LLVMIsNewDbgInfoFormat(M));
+
   LLVMDIBuilderRef DIB = LLVMCreateDIBuilder(M);
 
   LLVMMetadataRef File = LLVMDIBuilderCreateFile(DIB, Filename,
@@ -137,38 +140,13 @@ int llvm_test_dibuilder(bool NewDebugInfoFormat) {
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "a", 1, 1, File,
                                          42, Int64Ty, true, 0);
 
-  if (LLVMIsNewDbgInfoFormat(M))
-    LLVMDIBuilderInsertDeclareAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar1,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
-  else
-    LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar1,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
   LLVMMetadataRef FooParamVar2 =
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "b", 1, 2, File,
                                          42, Int64Ty, true, 0);
 
-  if (LLVMIsNewDbgInfoFormat(M))
-    LLVMDIBuilderInsertDeclareAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar2,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
-  else
-    LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar2,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
-
   LLVMMetadataRef FooParamVar3 =
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "c", 1, 3, File,
                                          42, VectorTy, true, 0);
-  if (LLVMIsNewDbgInfoFormat(M))
-    LLVMDIBuilderInsertDeclareAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar3,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
-  else
-    LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
-        DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar3,
-        FooParamExpression, FooParamLocation, FooEntryBlock);
 
   LLVMSetSubprogram(FooFunction, FunctionMetadata);
 
@@ -185,12 +163,9 @@ int llvm_test_dibuilder(bool NewDebugInfoFormat) {
   LLVMValueRef FooVal1 = LLVMConstInt(LLVMInt64Type(), 0, false);
   LLVMMetadataRef FooVarValueExpr =
     LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
-  if (LLVMIsNewDbgInfoFormat(M))
-    LLVMDIBuilderInsertDbgValueRecordAtEnd(
-        DIB, FooVal1, FooVar1, FooVarValueExpr, FooVarsLocation, FooVarBlock);
-  else
-    LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
-        DIB, FooVal1, FooVar1, FooVarValueExpr, FooVarsLocation, FooVarBlock);
+  
+  LLVMDIBuilderInsertDbgValueRecordAtEnd(
+      DIB, FooVal1, FooVar1, FooVarValueExpr, FooVarsLocation, FooVarBlock);
 
   LLVMMetadataRef MacroFile =
       LLVMDIBuilderCreateTempMacroFile(DIB, NULL, 0, File);
diff --git a/llvm/tools/llvm-c-test/llvm-c-test.h b/llvm/tools/llvm-c-test/llvm-c-test.h
index c50d3cce86748..f477f17e9c3b0 100644
--- a/llvm/tools/llvm-c-test/llvm-c-test.h
+++ b/llvm/tools/llvm-c-test/llvm-c-test.h
@@ -36,7 +36,7 @@ int llvm_calc(void);
 int llvm_disassemble(void);
 
 // debuginfo.c
-int llvm_test_dibuilder(bool NewDebugInfoFormat);
+int llvm_test_dibuilder();
 int llvm_get_di_tag(void);
 int llvm_di_type_get_name(void);
 
diff --git a/llvm/tools/llvm-c-test/main.c b/llvm/tools/llvm-c-test/main.c
index 9db6e05d6350d..8be9ea06fc68d 100644
--- a/llvm/tools/llvm-c-test/main.c
+++ b/llvm/tools/llvm-c-test/main.c
@@ -110,11 +110,8 @@ int main(int argc, char **argv) {
   } else if (argc == 2 && !strcmp(argv[1], "--test-diagnostic-handler")) {
     return llvm_test_diagnostic_handler();
   } else if (argc == 2 &&
-             !strcmp(argv[1], "--test-dibuilder-old-debuginfo-format")) {
-    return llvm_test_dibuilder(false);
-  } else if (argc == 2 &&
-             !strcmp(argv[1], "--test-dibuilder-new-debuginfo-format")) {
-    return llvm_test_dibuilder(true);
+             !strcmp(argv[1], "--test-dibuilder-debuginfo-format")) {
+    return llvm_test_dibuilder();
   } else {
     print_usage();
   }

>From 6ea846a362b569971ecbdae5558efeed046e0d6d Mon Sep 17 00:00:00 2001
From: Carlos Alberto Enciso <Carlos.Enciso at sony.com>
Date: Fri, 14 Jun 2024 14:15:00 +0100
Subject: [PATCH 2/4] [RemoveDIs] Update DIBuilder C API with DbgRecord
 functions.

Fix clang-format reported issues.
---
 llvm/tools/llvm-c-test/debuginfo.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c
index d7c8d2bb55269..89a347393200b 100644
--- a/llvm/tools/llvm-c-test/debuginfo.c
+++ b/llvm/tools/llvm-c-test/debuginfo.c
@@ -144,9 +144,8 @@ int llvm_test_dibuilder() {
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "b", 1, 2, File,
                                          42, Int64Ty, true, 0);
 
-  LLVMMetadataRef FooParamVar3 =
-    LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "c", 1, 3, File,
-                                         42, VectorTy, true, 0);
+  LLVMMetadataRef FooParamVar3 = LLVMDIBuilderCreateParameterVariable(
+      DIB, FunctionMetadata, "c", 1, 3, File, 42, VectorTy, true, 0);
 
   LLVMSetSubprogram(FooFunction, FunctionMetadata);
 
@@ -163,9 +162,9 @@ int llvm_test_dibuilder() {
   LLVMValueRef FooVal1 = LLVMConstInt(LLVMInt64Type(), 0, false);
   LLVMMetadataRef FooVarValueExpr =
     LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
-  
-  LLVMDIBuilderInsertDbgValueRecordAtEnd(
-      DIB, FooVal1, FooVar1, FooVarValueExpr, FooVarsLocation, FooVarBlock);
+
+  LLVMDIBuilderInsertDbgValueRecordAtEnd(DIB, FooVal1, FooVar1, FooVarValueExpr,
+                                         FooVarsLocation, FooVarBlock);
 
   LLVMMetadataRef MacroFile =
       LLVMDIBuilderCreateTempMacroFile(DIB, NULL, 0, File);

>From 2cd67a1a0dc57a89fe242ed6a1567020c820b2fb Mon Sep 17 00:00:00 2001
From: Carlos Alberto Enciso <Carlos.Enciso at sony.com>
Date: Mon, 17 Jun 2024 08:47:49 +0100
Subject: [PATCH 3/4] [RemoveDIs] Update DIBuilder C API with DbgRecord
 functions.

Address comments from @OCHyams.
---
 .../ocaml/debuginfo/debuginfo_ocaml.c         | 39 +++++++++++++++++++
 .../ocaml/debuginfo/llvm_debuginfo.ml         | 20 ++++++++++
 .../ocaml/debuginfo/llvm_debuginfo.mli        | 24 ++++++++++++
 llvm/docs/ReleaseNotes.rst                    |  9 +----
 llvm/docs/RemoveDIsDebugInfo.md               |  5 ---
 llvm/include/llvm-c/DebugInfo.h               | 24 ++++++++----
 .../Bindings/llvm-c/debug_info_new_format.ll  |  9 +++--
 llvm/tools/llvm-c-test/debuginfo.c            | 12 ++++++
 8 files changed, 119 insertions(+), 23 deletions(-)

diff --git a/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c b/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
index fd99724ca0559..ba4a9cbde37a4 100644
--- a/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
+++ b/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c
@@ -969,6 +969,45 @@ value llvm_dibuild_create_parameter_variable_bytecode(value *argv, int arg) {
   );
 }
 
+value llvm_dibuild_insert_declare_before_native(value Builder, value Storage,
+                                                value VarInfo, value Expr,
+                                                value DebugLoc, value Instr) {
+  LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareRecordBefore(
+      DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
+      Metadata_val(Expr), Metadata_val(DebugLoc), Value_val(Instr));
+  return to_val(Value);
+}
+
+value llvm_dibuild_insert_declare_before_bytecode(value *argv, int arg) {
+
+  return llvm_dibuild_insert_declare_before_native(argv[0], // Builder
+                                                   argv[1], // Storage
+                                                   argv[2], // VarInfo
+                                                   argv[3], // Expr
+                                                   argv[4], // DebugLoc
+                                                   argv[5]  // Instr
+  );
+}
+
+value llvm_dibuild_insert_declare_at_end_native(value Builder, value Storage,
+                                                value VarInfo, value Expr,
+                                                value DebugLoc, value Block) {
+  LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareRecordAtEnd(
+      DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
+      Metadata_val(Expr), Metadata_val(DebugLoc), BasicBlock_val(Block));
+  return to_val(Value);
+}
+
+value llvm_dibuild_insert_declare_at_end_bytecode(value *argv, int arg) {
+  return llvm_dibuild_insert_declare_at_end_native(argv[0], // Builder
+                                                   argv[1], // Storage
+                                                   argv[2], // VarInfo
+                                                   argv[3], // Expr
+                                                   argv[4], // DebugLoc
+                                                   argv[5]  // Block
+  );
+}
+
 value llvm_dibuild_expression(value Builder, value Addr) {
   return to_val(LLVMDIBuilderCreateExpression(
       DIBuilder_val(Builder), (uint64_t *)Op_val(Addr), Wosize_val(Addr)));
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
index 3098b28120cc0..8bb5edb17a2c9 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
@@ -592,6 +592,26 @@ external dibuild_create_parameter_variable :
   Llvm.llmetadata
   = "llvm_dibuild_create_parameter_variable_bytecode" "llvm_dibuild_create_parameter_variable_native"
 
+external dibuild_insert_declare_before :
+  lldibuilder ->
+  storage:Llvm.llvalue ->
+  var_info:Llvm.llmetadata ->
+  expr:Llvm.llmetadata ->
+  location:Llvm.llmetadata ->
+  instr:Llvm.llvalue ->
+  Llvm.lldbgrecord
+  = "llvm_dibuild_insert_declare_before_bytecode" "llvm_dibuild_insert_declare_before_native"
+
+external dibuild_insert_declare_at_end :
+  lldibuilder ->
+  storage:Llvm.llvalue ->
+  var_info:Llvm.llmetadata ->
+  expr:Llvm.llmetadata ->
+  location:Llvm.llmetadata ->
+  block:Llvm.llbasicblock ->
+  Llvm.lldbgrecord
+  = "llvm_dibuild_insert_declare_at_end_bytecode" "llvm_dibuild_insert_declare_at_end_native"
+
 external dibuild_expression :
   lldibuilder ->
   Int64.t array ->
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
index e3ee209a2ee2b..7c7882ccce855 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
@@ -652,6 +652,30 @@ val dibuild_create_parameter_variable :
 (** [dibuild_create_parameter_variable] Create a new descriptor for a
     function parameter variable. *)
 
+val dibuild_insert_declare_before :
+  lldibuilder ->
+  storage:Llvm.llvalue ->
+  var_info:Llvm.llmetadata ->
+  expr:Llvm.llmetadata ->
+  location:Llvm.llmetadata ->
+  instr:Llvm.llvalue ->
+  Llvm.lldbgrecord
+(** [dibuild_insert_declare_before]  Insert a new llvm.dbg.declare
+    intrinsic call before the given instruction [instr]. *)
+
+val dibuild_insert_declare_at_end :
+  lldibuilder ->
+  storage:Llvm.llvalue ->
+  var_info:Llvm.llmetadata ->
+  expr:Llvm.llmetadata ->
+  location:Llvm.llmetadata ->
+  block:Llvm.llbasicblock ->
+  Llvm.lldbgrecord
+(** [dibuild_insert_declare_at_end] Insert a new llvm.dbg.declare
+    intrinsic call at the end of basic block [block]. If [block]
+    has a terminator instruction, the intrinsic is inserted
+    before that terminator instruction. *)
+
 val dibuild_expression : lldibuilder -> Int64.t array -> Llvm.llmetadata
 (** [dibuild_expression] Create a new descriptor for the specified variable
     which has a complex address expression for its address.
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 56417e570fdb7..75d994a92c24e 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -234,12 +234,12 @@ Changes to the C API
   See the `debug info migration guide <https://llvm.org/docs/RemoveDIsDebugInfo.html>`_ for more info.
 
 * Added the following functions to get/set the new non-instruction debug info format.
+  They will be deprecated in the future and they are just a transition aid.
 
   * ``LLVMIsNewDbgInfoFormat``
   * ``LLVMSetIsNewDbgInfoFormat``
 
-* Added the following functions (no plans to deprecate) to insert a debug record
-  (new debug info format).
+* Added the following functions to insert a debug record (new debug info format).
 
   * ``LLVMDIBuilderInsertDeclareRecordBefore``
   * ``LLVMDIBuilderInsertDeclareRecordAtEnd``
@@ -253,11 +253,6 @@ Changes to the C API
   * ``LLVMDIBuilderInsertDbgValueBefore``
   * ``LLVMDIBuilderInsertDbgValueAtEnd``
 
-  * ``LLVMDIBuilderInsertDeclareIntrinsicBefore``
-  * ``LLVMDIBuilderInsertDeclareIntrinsicAtEnd``
-  * ``LLVMDIBuilderInsertDbgValueIntrinsicBefore``
-  * ``LLVMDIBuilderInsertDbgValueIntrinsicAtEnd``
-
 Changes to the CodeGen infrastructure
 -------------------------------------
 
diff --git a/llvm/docs/RemoveDIsDebugInfo.md b/llvm/docs/RemoveDIsDebugInfo.md
index b71143e991282..33c590e780079 100644
--- a/llvm/docs/RemoveDIsDebugInfo.md
+++ b/llvm/docs/RemoveDIsDebugInfo.md
@@ -147,11 +147,6 @@ LLVMDIBuilderInsertDeclareAtEnd    # Same as above.
 LLVMDIBuilderInsertDbgValueBefore  # Same as above.
 LLVMDIBuilderInsertDbgValueAtEnd   # Same as above.
 
-LLVMDIBuilderInsertDeclareIntrinsicBefore   # Insert a debug intrinsic (old debug info format).
-LLVMDIBuilderInsertDeclareIntrinsicAtEnd    # Same as above.
-LLVMDIBuilderInsertDbgValueIntrinsicBefore  # Same as above.
-LLVMDIBuilderInsertDbgValueIntrinsicAtEnd   # Same as above.
-
 New functions (to be deprecated)
 --------------------------------
 LLVMIsNewDbgInfoFormat     # Returns true if the module is in the new non-instruction mode.
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 81a888c0f4d91..38a1f93d0c38b 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -1262,10 +1262,12 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
     LLVMMetadataRef Decl, uint32_t AlignInBits);
 
 /**
- * Soon to be deprecated.
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
+ * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
  * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
  *
+ * The debug format can be switched later after inserting the records using
+ * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
+ *
  * Insert a Declare DbgRecord before the given instruction.
  * \param Builder     The DIBuilder.
  * \param Storage     The storage of the variable to declare.
@@ -1279,10 +1281,12 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 
 /**
- * Soon to be deprecated.
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
+ * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
  * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
  *
+ * The debug format can be switched later after inserting the records using
+ * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
+ *
  * Insert a Declare DbgRecord at the end of the given basic block. If the basic
  * block has a terminator instruction, the record is inserted before that
  * terminator instruction.
@@ -1298,10 +1302,12 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
 
 /**
- * Soon to be deprecated.
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
+ * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
  * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
  *
+ * The debug format can be switched later after inserting the records using
+ * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
+ *
  * Insert a new llvm.dbg.value intrinsic call before the given instruction.
  * \param Builder     The DIBuilder.
  * \param Val         The value of the variable.
@@ -1315,10 +1321,12 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
 
 /**
- * Soon to be deprecated.
- * Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
+ * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
  * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
  *
+ * The debug format can be switched later after inserting the records using
+ * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
+ *
  * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
  * block. If the basic block has a terminator instruction, the intrinsic is
  * inserted before that terminator instruction.
diff --git a/llvm/test/Bindings/llvm-c/debug_info_new_format.ll b/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
index 3e654afef3592..a9ba9d7ad05a7 100644
--- a/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
+++ b/llvm/test/Bindings/llvm-c/debug_info_new_format.ll
@@ -6,12 +6,14 @@
 
 ; CHECK:      define i64 @foo(i64 %0, i64 %1, <10 x i64> %2) !dbg !31 {
 ; CHECK-NEXT: entry:
+; CHECK-NEXT:     #dbg_declare(i64 0, !38, !DIExpression(), !43)
+; CHECK-NEXT:     #dbg_declare(i64 0, !39, !DIExpression(), !43)
+; CHECK-NEXT:     #dbg_declare(i64 0, !40, !DIExpression(), !43)
 ; CHECK-NEXT:   br label %vars
-
 ; CHECK:      vars:
 ; CHECK-NEXT:   %p1 = phi i64 [ 0, %entry ]
 ; CHECK-NEXT:   %p2 = phi i64 [ 0, %entry ]
-; CHECK-NEXT:     #dbg_value(i64 0, !41, !DIExpression(DW_OP_constu, 0, DW_OP_stack_value), !43)
+; CHECK-NEXT:     #dbg_value(i64 0, !41, !DIExpression(DW_OP_constu, 0, DW_OP_stack_value), !44)
 ; CHECK-NEXT:   %a = add i64 %p1, %p2
 ; CHECK-NEXT:   ret i64 0
 ; CHECK-NEXT: }
@@ -63,4 +65,5 @@
 ; CHECK-NEXT: !40 = !DILocalVariable(name: "c", arg: 3, scope: !31, file: !1, line: 42, type: !34)
 ; CHECK-NEXT: !41 = !DILocalVariable(name: "d", scope: !42, file: !1, line: 43, type: !6)
 ; CHECK-NEXT: !42 = distinct !DILexicalBlock(scope: !31, file: !1, line: 42)
-; CHECK-NEXT: !43 = !DILocation(line: 43, scope: !31)
+; CHECK-NEXT: !43 = !DILocation(line: 42, scope: !31)
+; CHECK-NEXT: !44 = !DILocation(line: 43, scope: !31)
diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c
index 89a347393200b..5519cb076546d 100644
--- a/llvm/tools/llvm-c-test/debuginfo.c
+++ b/llvm/tools/llvm-c-test/debuginfo.c
@@ -140,13 +140,25 @@ int llvm_test_dibuilder() {
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "a", 1, 1, File,
                                          42, Int64Ty, true, 0);
 
+  LLVMDIBuilderInsertDeclareRecordAtEnd(
+      DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar1,
+      FooParamExpression, FooParamLocation, FooEntryBlock);
+
   LLVMMetadataRef FooParamVar2 =
     LLVMDIBuilderCreateParameterVariable(DIB, FunctionMetadata, "b", 1, 2, File,
                                          42, Int64Ty, true, 0);
 
+  LLVMDIBuilderInsertDeclareRecordAtEnd(
+      DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar2,
+      FooParamExpression, FooParamLocation, FooEntryBlock);
+
   LLVMMetadataRef FooParamVar3 = LLVMDIBuilderCreateParameterVariable(
       DIB, FunctionMetadata, "c", 1, 3, File, 42, VectorTy, true, 0);
 
+  LLVMDIBuilderInsertDeclareRecordAtEnd(
+      DIB, LLVMConstInt(LLVMInt64Type(), 0, false), FooParamVar3,
+      FooParamExpression, FooParamLocation, FooEntryBlock);
+
   LLVMSetSubprogram(FooFunction, FunctionMetadata);
 
   LLVMMetadataRef FooLexicalBlock =

>From 018cac9ce6440661a39750e20aec66085664cb9c Mon Sep 17 00:00:00 2001
From: Carlos Alberto Enciso <Carlos.Enciso at sony.com>
Date: Mon, 17 Jun 2024 13:17:49 +0100
Subject: [PATCH 4/4] [RemoveDIs] Update DIBuilder C API with DbgRecord
 functions.

Address comments from @OCHyams and @nikic.
---
 llvm/docs/ReleaseNotes.rst      |  8 +++++---
 llvm/include/llvm-c/DebugInfo.h | 12 ++++++------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 75d994a92c24e..9cf2690454fff 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -220,6 +220,10 @@ Changes to the C API
   * ``LLVMConstICmp``
   * ``LLVMConstFCmp``
 
+**Note:** The following changes are due to the removal of the debug info
+intrinsics from LLVM and to the introduction of debug records into LLVM.
+They are described in detail in the `debug info migration guide <https://llvm.org/docs/RemoveDIsDebugInfo.html>`_.
+
 * Added the following functions to insert before the indicated instruction but
   after any attached debug records.
 
@@ -231,8 +235,6 @@ Changes to the C API
   instruction. ``LLVMPositionBuilder`` and ``LLVMPositionBuilderBefore`` are
   unchanged.
 
-  See the `debug info migration guide <https://llvm.org/docs/RemoveDIsDebugInfo.html>`_ for more info.
-
 * Added the following functions to get/set the new non-instruction debug info format.
   They will be deprecated in the future and they are just a transition aid.
 
@@ -246,7 +248,7 @@ Changes to the C API
   * ``LLVMDIBuilderInsertDbgValueRecordBefore``
   * ``LLVMDIBuilderInsertDbgValueRecordAtEnd``
 
-* Deleted the following functions that inserted a debug intrinsic (old debug info format)
+* Deleted the following functions that inserted a debug intrinsic (old debug info format).
 
   * ``LLVMDIBuilderInsertDeclareBefore``
   * ``LLVMDIBuilderInsertDeclareAtEnd``
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 38a1f93d0c38b..6d8891e705772 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -1308,13 +1308,13 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
  * The debug format can be switched later after inserting the records using
  * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
  *
- * Insert a new llvm.dbg.value intrinsic call before the given instruction.
+ * Insert a new debug record before the given instruction.
  * \param Builder     The DIBuilder.
  * \param Val         The value of the variable.
  * \param VarInfo     The variable's debug info descriptor.
  * \param Expr        A complex location expression for the variable.
  * \param DebugLoc    Debug info location.
- * \param Instr       Instruction acting as a location for the new intrinsic.
+ * \param Instr       Instruction acting as a location for the new record.
  */
 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
     LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
@@ -1327,15 +1327,15 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
  * The debug format can be switched later after inserting the records using
  * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
  *
- * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
- * block. If the basic block has a terminator instruction, the intrinsic is
- * inserted before that terminator instruction.
+ * Insert a new debug record at the end of the given basic block. If the
+ * basic block has a terminator instruction, the record is inserted before
+ * that terminator instruction.
  * \param Builder     The DIBuilder.
  * \param Val         The value of the variable.
  * \param VarInfo     The variable's debug info descriptor.
  * \param Expr        A complex location expression for the variable.
  * \param DebugLoc    Debug info location.
- * \param Block       Basic block acting as a location for the new intrinsic.
+ * \param Block       Basic block acting as a location for the new record.
  */
 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(
     LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,



More information about the llvm-commits mailing list