[PATCH] D42254: Add optional DICompileUnit to DIBuilder and make outlined debug info use that CU

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 11:19:35 PST 2018


paquette created this revision.
paquette added reviewers: aprantl, probinson, dblaikie.
Herald added a subscriber: JDevlieghere.

Previously, I committed a change to the outliner which added some debug information to outlined functions. This wasn't entirely great because DIBuilder only sets its CU using createCompileUnit. As a result, the outliner had to make a second compile unit just for the outlined sequences.

This sparked an e-mail discussion on the topic, so I'm putting the patch up here just because it's a bit easier to read + discuss.

The only change to DIBuilder is an added optional parameter in the constructor which allows you to set the CU if you already know what you want. There are no functional changes to it otherwise. The rest of the changes are in the outliner. It works like this:

1. Keep track of the MachineFunction that each Candidate appears in. Use that to get a CU for that Candidate if possible.
2. To find a CU for an OutlinedFunction, grab the first CU belonging to some Candidate associated with that function.
3. When you create a function, see if it has a potential CU. If it does, then generate debug info for the outlined function.


https://reviews.llvm.org/D42254

Files:
  include/llvm/IR/DIBuilder.h
  lib/CodeGen/MachineOutliner.cpp
  lib/IR/DIBuilder.cpp
  test/CodeGen/X86/machine-outliner-disubprogram.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42254.130439.patch
Type: text/x-patch
Size: 8833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/271b80c9/attachment.bin>


More information about the llvm-commits mailing list