DebugInfo: Include .dwo file name when hashing multiple CUs in a single file
authorMehdi Amini <joker.eph@gmail.com>
Mon, 29 May 2017 06:32:34 +0000 (06:32 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 29 May 2017 06:32:34 +0000 (06:32 +0000)
commit96ab48f9dac815219ed7f9a62283ce29e96429bd
tree31a231fa50a8d47156dddfe84490c920f4f65088
parent418120556398c01550d42500d56e6d328290185b
DebugInfo: Include .dwo file name when hashing multiple CUs in a single file

This is really a workaround for ThinLTO in particular - since it can
import partial CUs that may end up looking very similar/the same as
the same partial import in another ThinLTO compile.

An alternative fix would be to change the DICompileUnit metadata to
include a "primary file" or the like - and when importing for ThinLTO
set the primary file to the name of the DICompileUnit that is being
imported into. This involves changing the schema and would reduce the
excessive uniqueness in the hash that this change creates - allowing
diagnosing of more duplicate CUs than will be caught with this change.

But duplicate CUs can still be caught in non-ThinLTO builds & are mostly
a nuisance rather than a particularly deliberate/effective tool for
finding broken code. (arguably the hash could always include the dwo
file and nothing in fission would break, I think..)

Reapply of r304119 after adding a triple to the test and moving it
to the X86 directory.

llvm-svn: 304130
llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/lib/CodeGen/AsmPrinter/DIEHash.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/split-dwarf-multiple-cu-hash.ll [new file with mode: 0644]