[all-commits] [llvm/llvm-project] 3feea3: [DebugInfo] Do not delete debug intrinsics with em...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Wed Apr 26 01:58:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3feea34d77f65f0b68520bb7bf372580a72794ad
      https://github.com/llvm/llvm-project/commit/3feea34d77f65f0b68520bb7bf372580a72794ad
  Author: OCHyams <orlando.hyams at sony.com>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/DebugInfo/Generic/empty-metadata.ll
    M llvm/unittests/Transforms/Utils/LocalTest.cpp

  Log Message:
  -----------
  [DebugInfo] Do not delete debug intrinsics with empty metadata operands

A ValueAsMetadata may be replaced with nullptr for several reasons including
deleting (certain) values and value remapping a use-before-def. In the case of
a MetadataAsValue user, handleChangedOperand intercepts and replaces the
metadata with an empty tuple (!{}).

At the moment, an empty metadata operand in a debug intrinsics signals that it
can be deleted.

Given that we end up with empty metadata operands in circumstances where the
Value has been "lost" the current behaviour can lead to incorrect variable
locations. Instead, we should treat empty metadata as meaning "there is no
location for the variable" (the same as we currently treat undef operands).

This patch removes the deletion logic from wouldInstructionBeTriviallyDead.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

Reviewed By: StephenTozer

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




More information about the All-commits mailing list