[all-commits] [llvm/llvm-project] 2298a4: [CodeView] Add support for local S_CONSTANT records

Tobias Hieta via All-commits all-commits at lists.llvm.org
Tue Dec 6 01:34:16 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2298a44ccdc1a9babcb2712a0019d064b3cecd5a
      https://github.com/llvm/llvm-project/commit/2298a44ccdc1a9babcb2712a0019d064b3cecd5a
  Author: Tobias Hieta <tobias at hieta.se>
  Date:   2022-12-06 (Tue, 06 Dec 2022)

  Changed paths:
    M lld/COFF/PDB.cpp
    A lld/test/COFF/Inputs/pdb-local-constants.s
    A lld/test/COFF/pdb-local-constants.test
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
    M llvm/test/DebugInfo/COFF/local-constant.ll
    M llvm/test/DebugInfo/COFF/pieces.ll

  Log Message:
  -----------
  [CodeView] Add support for local S_CONSTANT records

CodeView doesn't have the ability to represent variables
in other ways than as in registers or memory values, but
LLVM very often transforms simple values into constants,
consider this program:

int f () { int i = 123; return i; }

LLVM will transform `i` into a constant value and just
leave behind a llvm.dbg.value, this can't be represented
as a S_LOCAL record in CodeView. But we can represent it
as a S_CONSTANT record.

This patch checks if the location of a debug value is null,
then we will insert a S_CONSTANT record instead of a S_LOCAL
value with the flag "OptimizedAway".

In lld we then output the S_CONSTANT in the right scope, before
they where always inserted in the global stream, now we check
the scope before inserting it.

This has shown to improve debugging for our developers
internally.

Fixes to llvm/llvm-project#55958

Reviewed By: aganea

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




More information about the All-commits mailing list