[all-commits] [llvm/llvm-project] 78d15a: [DWARF] Fix PR51087 Extraneous enum record in DWAR...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Fri Dec 17 02:11:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78d15a112cbd545fbb6e1aa37c221ef5aeffb3f2
      https://github.com/llvm/llvm-project/commit/78d15a112cbd545fbb6e1aa37c221ef5aeffb3f2
  Author: OCHyams <orlando.hyams at sony.com>
  Date:   2021-12-17 (Fri, 17 Dec 2021)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
    A llvm/test/DebugInfo/Generic/type-units-maybe-unused-types.ll

  Log Message:
  -----------
  [DWARF] Fix PR51087 Extraneous enum record in DWARF with type units

Fixes https://llvm.org/PR51087: Extraneous enum record in DWARF with type units.

As explained in PR51087 we sometimes get skeleton DIEs for enums in a Dwarf
Compile Unit (CU) that are not referenced from any CU and are already described
by a type unit.

Types for enums are emitted whether used or not, all together before most types
in the CU. Mechanically, the extraneous CU records are generated because the
enum types are generated with a call to CU->getOrCreateTypeDIE. This function
will recursively get-or-create the parent DIE (in the CU) and the type unit for
each. We don't need the CU-side DIEs if the type units are sucesfully
emitted. Fix by only emitting the type units for enums if possible, falling back
to a call to getOrCreateTypeDIE if not. Do the same for retained types.

Reviewed By: dblaikie

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




More information about the All-commits mailing list