SuccessChanges

Summary

  1. [Instruction] Set metadata uses to undef on deletion (details)
  2. Revert "Add nomerge function attribute to clang" (details)
Commit 77ffce6954470018de1748d33f9ac6aa66121e9f by Vedant Kumar
[Instruction] Set metadata uses to undef on deletion

Summary:
Replace any extant metadata uses of a dying instruction with undef to
preserve debug info accuracy. Some alternatives include:

- Treat Instruction like any other Value, and point its extant metadata
  uses to an empty ValueAsMetadata node. This makes extant dbg.value uses
  trivially dead (i.e. fair game for deletion in many passes), leading to
  stale dbg.values being in effect for too long.

- Call salvageDebugInfoOrMarkUndef. Not needed to make instruction removal
  correct. OTOH results in wasted work in some common cases (e.g. when all
  instructions in a BasicBlock are deleted).

This came up while discussing some basic cases in
https://reviews.llvm.org/D80052.

Reviewers: jmorse, TWeaver, aprantl, dexonsmith, jdoerfert

Subscribers: jholewinski, qcolombet, hiraditya, jfb, sstefan1, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80264
The file was modifiedllvm/lib/IR/Instruction.cpp
The file was modifiedllvm/test/DebugInfo/NVPTX/debug-addr-class.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/AArch64/spillcost-di.ll
The file was modifiedllvm/test/Transforms/SafeStack/X86/debug-loc2.ll
The file was modifiedllvm/test/DebugInfo/NVPTX/debug-info.ll
The file was modifiedllvm/unittests/IR/DebugInfoTest.cpp
Commit b0a0f01bc175b4c444052f871a89421889f8b5ce by zequanwu
Revert "Add nomerge function attribute to clang"

This reverts commit 307e85395485e1eff9533b2d7952b16f33ceae38.
The file was modifiedclang/lib/Sema/SemaStmtAttr.cpp
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was modifiedclang/lib/CodeGen/CodeGenFunction.h
The file was modifiedclang/lib/CodeGen/CGStmt.cpp
The file was removedclang/test/CodeGen/attr-nomerge.cpp
The file was removedclang/test/Sema/attr-nomerge.cpp
The file was modifiedclang/lib/CodeGen/CGCall.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/include/clang/Basic/Attr.td