OSDN Git Service

IR: Don't track nullptr on metadata RAUW
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Dec 2014 19:24:33 +0000 (19:24 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Dec 2014 19:24:33 +0000 (19:24 +0000)
commit85cbe57fc5986e9fc0480d8259725616475c9355
tree0afd59eaeaed554857b6f3e69531d1dd83e0440c
parent8ef835e3dcd52bfdd82c901e3e1f1c52b3658aa1
IR: Don't track nullptr on metadata RAUW

The RAUW support in `Metadata` supports going to `nullptr` specifically
to handle values being deleted, causing `ValueAsMetadata` to be deleted.

Fix the case where the reference is from a `TrackingMDRef` (as opposed
to an `MDOperand` or a `MetadataAsValue`).

This is surprisingly rare -- metadata tracked by `TrackingMDRef` going
to null -- but it came up in an openSUSE bootstrap during inlining.  The
tracking ref was held by the `ValueMap` because it was referencing a
local, the basic block containing the local became dead after it had
been merged in, and when the local was deleted, the tracking ref
asserted in an `isa`.

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