[all-commits] [llvm/llvm-project] 29077a: [IRBuilder] Generalize debug loc handling for arbi...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Dec 17 05:33:21 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 29077ae860bcf3c9e9f2ce67ca7dfe691b6fa148
      https://github.com/llvm/llvm-project/commit/29077ae860bcf3c9e9f2ce67ca7dfe691b6fa148
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-12-17 (Thu, 17 Dec 2020)

  Changed paths:
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

  Log Message:
  -----------
  [IRBuilder] Generalize debug loc handling for arbitrary metadata.

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.

Reviewed By: lebedev.ri

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




More information about the All-commits mailing list