[all-commits] [llvm/llvm-project] ee371b: [DebugInfo] Treat empty metadata operands the same...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Tue Apr 25 09:18:40 PDT 2023


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

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicInst.h
    M llvm/unittests/IR/DebugInfoTest.cpp

  Log Message:
  -----------
  [DebugInfo] Treat empty metadata operands the same as undef operands

A `ValueAsMetadata` may be replaced with nullptr for several reasons including
deleting 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 changes `isKillLocation` to take this into account.

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

Reviewed By: StephenTozer

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




More information about the All-commits mailing list