DebugInfo: Don't hash DIE offsets before they're computed
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 25 Dec 2021 23:59:29 +0000 (15:59 -0800)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 26 Dec 2021 00:09:12 +0000 (16:09 -0800)
commit2bddab25dba8d4b0932dc2b6cacef13fcf8a0694
treeb080b251b1188a19db109504857f57dc2ec07667
parenta00f480fe8ee5236abfe6ba89ec17f113b6fe132
DebugInfo: Don't hash DIE offsets before they're computed

Instead of hashing DIE offsets, hash DIE references the same as they
would be when used outside of a loclist - that is, deep hash the type on
first use, and hash the numbering on subsequent uses.

This does produce different hashes for different type references, where
it did not before (because we were hashing zero all the time - so it
didn't matter what type was referenced, the hash would be identical).

This also allows us to enforce that the DIE offset (& size) is not
queried before it is used (which came up while investigating another bug
recently).
llvm/include/llvm/CodeGen/DIE.h
llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h
llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/lib/CodeGen/AsmPrinter/DIEHash.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/convert-loclist.ll