[PATCH] D105251: [IR] Allow multiple instruction metadata attachments with same type

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 17:19:54 PDT 2021


tejohnson created this revision.
tejohnson added reviewers: davidxl, snehasish.
Herald added subscribers: dexonsmith, wenlei, hiraditya.
tejohnson requested review of this revision.
Herald added a project: LLVM.

This is modeled on D20414 <https://reviews.llvm.org/D20414> which added this support to global objects,
but not instructions. Note D67626 <https://reviews.llvm.org/D67626> later refactored these interfaces
into the Value base class, but Instruction does not use this directly
because of special handling needed for the DbgLoc metadata.

I'm adding the support to instructions because it may be needed for
profile guided heap optimization
(https://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html)
depending on how that profile data is represented in the IR, as a
single allocation call may contain multiple heap profiles for
different contexts, and because it is an inconsistency in IR support
(the LLVM langref does not specify anything with regards to this
behavior).

I've added a generic Assembler test change similar to what was done
in D20414 <https://reviews.llvm.org/D20414>, but also augmented a branch-weight test to validate the
change made to BitcodeReader.cpp.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105251

Files:
  llvm/include/llvm/IR/Instruction.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Reader/MetadataLoader.cpp
  llvm/lib/IR/Metadata.cpp
  llvm/lib/Transforms/Utils/ValueMapper.cpp
  llvm/test/Assembler/metadata.ll
  llvm/test/Bitcode/Inputs/branch-weight.bc
  llvm/test/Bitcode/branch-weight.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105251.355733.patch
Type: text/x-patch
Size: 8840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210701/0e011570/attachment.bin>


More information about the llvm-commits mailing list