[PATCH] D70260: [DebugInfo] Support for DW_OP_implicit_pointer (salvagDebugInfo improvement).

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 11:11:17 PST 2019


alok created this revision.
alok added reviewers: aprantl, probinson, dblaikie, jmorse, jini.susan.george, SouraVX, awpandey.
alok added projects: debug-info, LLVM.
Herald added subscribers: llvm-commits, hiraditya.

This patch (3/N) stems from D69787 <https://reviews.llvm.org/D69787> as suggested by reviewers.

Summary:

- Whenever alloca is getting deleted, lets handle this to preserve debug info
- Collect a variable description from corresponding llvm.dbg.declare intrinsic and pass that information to llvm.dbg.value intrinsic to create

  Before transformation %a = alloca [2 x i32], align 4 call void @llvm.dbg.declare(metadata [2 x i32]* %arr, metadata !16, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata [2 x i32]* %arr, metadata !20, metadata !DIExpression()), !dbg !24 !16 = !DILocalVariable(name: "arr", scope: !12, file: !3, line: 5, type: !17) !20 = !DILocalVariable(name: "ptr", scope: !12, file: !3, line: 6, type: !21)

  After Transformation %a = alloca [2 x i32], align 4 call void @llvm.dbg.declare(metadata [2 x i32]* %arr, metadata !16, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata !16, metadata !20, metadata !DIExpression(DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_arg0, 0)), !dbg !24 call void @llvm.dbg.value(metadata !16, metadata !20, metadata !DIExpression(DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_arg0, 4)), !dbg !24
  - In case llvm.dbg.declare is getting deleted before alloca instruction, preserve variable description map to use later.

    Testing:
    - check-llvm
    - check-debuginfo (the debug info integration tests)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70260

Files:
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/Transforms/Utils/Local.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70260.229360.patch
Type: text/x-patch
Size: 8539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191114/c4390a00/attachment.bin>


More information about the llvm-commits mailing list