This is an archive of the discontinued LLVM Phabricator instance.

Prevent RemoveDeadNodes from deleted already deleted node.
ClosedPublic

Authored by niravd on May 31 2017, 11:05 AM.

Details

Summary

This prevents against assertion errors like PR32659 which occur from a
replacement deleting a node after it's been added to the list argument
of RemoveDeadNodes.

Diff Detail

Repository
rL LLVM

Event Timeline

niravd created this revision.May 31 2017, 11:05 AM
spatel edited edge metadata.Jun 4 2017, 9:41 AM

The code change seems safe, but the test doesn't fail with recent trunk (I tried r304685).

Is there still a way to expose the bug? If not, can we just assert that no deleted node can get this far?

Is there still a way to expose the bug?

I'm reasonably there's a sequence that could trigger the bug in some backend, but I don't think I can generate it. The failing test was dealing with a net of TokenFactors fusedin a single instruction which wasn't being simplified.

If not, can we just assert that no deleted node can get this far?

Unfortunately no. The original bug is that we're triggering on a deleted_node a bit further down in deallocation. the caller of the changed function is builds up a list of nodes to delete after having moved some of the the users of the added nodes' values. But it's possible that moving those values will cause a previously added node to be deleted. I could filter the node vector on the caller side and prune there, but that's just a un-loopfused version of this.

spatel accepted this revision.Jun 8 2017, 8:14 AM

OK - please include the explanation in the commit message. LGTM.

This revision is now accepted and ready to land.Jun 8 2017, 8:14 AM
This revision was automatically updated to reflect the committed changes.