IR: Drop metadata references more aggressively during teardown
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Jan 2015 21:58:17 +0000 (21:58 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Jan 2015 21:58:17 +0000 (21:58 +0000)
commit0294f639d281ea3308ecbb3a50ef2e9893bcccf9
treec89c52444a31d835e33c6a58992c4ccfb905bcb7
parent33f5127540aa151e2611b82c7590276ab8a48cb8
IR: Drop metadata references more aggressively during teardown

Sometimes teardown happens before the debug info graph is complete
(e.g., when clang throws an error).  In that case, `MDNode`s will still
have RAUW, so deleting constants that the `MDNode`s point at will be
relatively expensive -- it'll cause re-uniquing all up the chain (what
I've been referring to as "teardown madness").

So, drop references *before* deleting constants.  We need to drop a few
more references now: the metadata side of the metadata/value bridges
needs to be dropped off the cliff along with the rest of it (previously,
the bridges were cleaned before we did anything with the `MDNode`s).

There's no real functionality change here -- state before and after
`LLVMContextImpl::~LLVMContextImpl()` is unchanged -- so no testcase.

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