[PATCH] D93400: [IRBuilder] Generalize debug loc handling for arbitrary metadata.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 07:55:46 PST 2020


fhahn created this revision.
fhahn added reviewers: thegameg, spatel, jdoerfert, RKSimon, lebedev.ri, aprantl, vsk.
Herald added subscribers: dexonsmith, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

This patch extends IRBuilder to allow adding/preserving arbitrary
metadata on created instructions.

Instead of using references to specific metadata nodes (like DebugLoc),
IRbuilder now keeps a vector of (metadata kind, MDNode *) pairs, which
are added to each created instruction.

The patch itself is a NFC and only moves the existing debug location
handling over to the new system. In a follow-up patch it will be used to
preserve !annotation metadata besides !dbg.

The current approach requires iterating over MetadataToCopy to avoid
adding duplicates, but given that the number of metadata kinds to
copy/preserve is going to be very small initially (0, 1 (for !dbg) or 2
(!dbg and !annotation)) that should not matter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93400

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
  llvm/lib/IR/Core.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93400.312215.patch
Type: text/x-patch
Size: 4784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201216/d30c048d/attachment.bin>


More information about the llvm-commits mailing list