IR: Simplify uniquing for MDNode
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 17 Nov 2014 23:28:21 +0000 (23:28 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 17 Nov 2014 23:28:21 +0000 (23:28 +0000)
commitf39c3b8108c34148e6f03cbd0907619020c1a9eb
tree926171fdd7152f05d559aac797d7be0d5f9e0379
parent099263b48706d8ef833f0aa823d115eef4de7c43
IR: Simplify uniquing for MDNode

Change uniquing from a `FoldingSet` to a `DenseSet` with custom
`DenseMapInfo`.  Unfortunately, this doesn't save any memory, since
`DenseSet<T>` is a simple wrapper for `DenseMap<T, char>`, but I'll come
back to fix that later.

I used the name `GenericDenseMapInfo` to the custom `DenseMapInfo` since
I'll be splitting `MDNode` into two classes soon: `MDNodeFwdDecl` for
temporaries, and `GenericMDNode` for everything else.

I also added a non-debug-info reduced version of a type-uniquing test
that started failing on an earlier draft of this patch.

Part of PR21532.

llvm-svn: 222191
llvm/include/llvm/IR/Metadata.h
llvm/lib/IR/LLVMContextImpl.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/Metadata.cpp
llvm/test/Linker/Inputs/unique-fwd-decl-b.ll [new file with mode: 0644]
llvm/test/Linker/unique-fwd-decl-a.ll [new file with mode: 0644]