mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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
This commit is contained in:
@@ -173,7 +173,8 @@ void ReplaceableMetadataImpl::replaceAllUsesWith(Metadata *MD) {
|
||||
// Update unowned tracking references directly.
|
||||
Metadata *&Ref = *static_cast<Metadata **>(Pair.first);
|
||||
Ref = MD;
|
||||
MetadataTracking::track(Ref);
|
||||
if (MD)
|
||||
MetadataTracking::track(Ref);
|
||||
UseMap.erase(Pair.first);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user