Streamline the API of salvageDebugInfoImpl (NFC)
authorAdrian Prantl <aprantl@apple.com>
Mon, 2 Aug 2021 23:59:45 +0000 (16:59 -0700)
committerAdrian Prantl <aprantl@apple.com>
Tue, 10 Aug 2021 22:21:18 +0000 (15:21 -0700)
commitd6b6880172f295211dd9139a68ba2f42add53ba9
tree5c52d8563f865835ab6253b9f7d70ea3aeeecbec
parent56175b2f5cd56eadf964fcea30f04ae2ac2f2a26
Streamline the API of salvageDebugInfoImpl (NFC)

This patch refactors / simplifies salvageDebugInfoImpl(). The goal
here is to simplify the implementation of coro::salvageDebugInfo() in
a followup patch.

  1. Change the return value to I.getOperand(0). Currently users of
     salvageDebugInfoImpl() assume that the first operand is
     I.getOperand(0). This patch makes this information explicit. A
     nice side-effect of this change is that it allows us to salvage
     expressions such as add i8 1, %a in the future.

  2. Factor out the creation of a DIExpression and return an array of
     DIExpression operations instead. This change allows users that
     call salvageDebugInfoImpl() in a loop to avoid the costly
     creation of temporary DIExpressions and to defer the creation of
     a DIExpression until the end.

This patch does not change any functionality.

rdar://80227769

Differential Revision: https://reviews.llvm.org/D107383
llvm/include/llvm/Transforms/Utils/Local.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Utils/Local.cpp