[Assignment Tracking][8/*] Add DIAssignID merging utilities
authorOCHyams <orlando.hyams@sony.com>
Wed, 9 Nov 2022 10:41:28 +0000 (10:41 +0000)
committerOCHyams <orlando.hyams@sony.com>
Wed, 9 Nov 2022 10:46:04 +0000 (10:46 +0000)
commita9025f57bac1121a2aa5ac05f48f611cd2b3a64f
tree28aa97d38885d7278b6b3a4724f576a77cefa64f
parenta621e799168ff6e57c27a49e6badd40b16bc44a8
[Assignment Tracking][8/*] Add DIAssignID merging utilities

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Add method:

  Instruction::mergeDIAssignID(
      ArrayRef<const Instruction* > SourceInstructions)

which merges the DIAssignID metadata attachments on `SourceInstructions` and
`this` and replaces uses of the original IDs with the new shared one.

This is used when stores are merged, for example sinking stores out of a
if-diamond CFG or vectorizing contiguous stores.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D133291
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/DebugInfo.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/unittests/IR/DebugInfoTest.cpp