diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-25 02:26:32 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-25 02:26:32 +0000 |
commit | 004ced3b087fd42bbf14a22b53a53b95f5bfd036 (patch) | |
tree | ef3db6d1afd129e9f54bbddba9989ce2339e654d /llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp | |
parent | d5f1db6b36d5e09bdad814da40505b8b792c49fc (diff) | |
download | llvm-004ced3b087fd42bbf14a22b53a53b95f5bfd036.zip llvm-004ced3b087fd42bbf14a22b53a53b95f5bfd036.tar.gz llvm-004ced3b087fd42bbf14a22b53a53b95f5bfd036.tar.bz2 |
Linker: Drop function pointers for overridden subprograms
Instead of dropping subprograms that have been overridden, just set
their function pointers to `nullptr`. This is a minor adjustment to the
stop-gap fix for PR21910 committed in r224487, and fixes the crasher
from PR22792.
The problem that r224487 put a band-aid on: how do we find the canonical
subprogram for a `Function`? Since the backend currently relies on
`DebugInfoFinder` (which does a naive in-order traversal of compile
units and picks the first subprogram) for this, r224487 tried dropping
non-canonical subprograms.
Dropping subprograms fails because the backend *also* builds up a map
from subprogram to compile unit (`DwarfDebug::SPMap`) based on the
subprogram lists. A missing subprogram causes segfaults later when an
inlined reference (such as in this testcase) is created.
Instead, just drop the `Function` pointer to `nullptr`, which nicely
mirrors what happens when an already-inlined `Function` is optimized
out. We can't really be sure that it's the same definition anyway, as
the testcase demonstrates.
This still isn't completely satisfactory. Two flaws at least that I can
think of:
- I still haven't found a straightforward way to make this symmetric
in the IR. (Interestingly, the DWARF output is already symmetric,
and I've tested for that to be sure we don't regress.)
- Using `DebugInfoFinder` to find the canonical subprogram for a
function is kind of crazy. We should just attach metadata to the
function, like this:
define weak i32 @foo(i32, i32) !dbg !MDSubprogram(...) {
llvm-svn: 233164
Diffstat (limited to 'llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions