IR: Allow temporary nodes to become uniqued or distinct
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 22:24:52 +0000 (22:24 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 22:24:52 +0000 (22:24 +0000)
commit37c7ccc40c8540a9c23b1c57c444fd038d4e37cb
treee88277b51947c8ddcffcf041496e04a152c8064e
parent65bb48b6fc500f42d4340d909ec22893d4c56741
IR: Allow temporary nodes to become uniqued or distinct

Add `MDNode::replaceWithUniqued()` and `MDNode::replaceWithDistinct()`,
which mutate temporary nodes to become uniqued or distinct.  On uniquing
collisions, the unique version is returned and the node is deleted.

This takes advantage of temporary nodes being folded back in, and should
let me clean up some awkward logic in `MapMetadata()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226510 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Metadata.h
lib/IR/Metadata.cpp
unittests/IR/MetadataTest.cpp