This is an archive of the discontinued LLVM Phabricator instance.

CodeGenPrep: remove AssertingVH references before deleting dead instructions.
AcceptedPublic

Authored by t.p.northover on Jun 4 2020, 6:37 AM.

Details

Reviewers
hfinkel
Summary

CodeGenPrepare keeps fairly close track of various instructions it's seen, particularly GEPs, in maps and vectors. However, sometimes those instructions become dead and get removed while it's still executing. This triggers AssertingVH references to them in an asserts build and could lead to miscompiles in a release build (I've only seen a later segfault though).

So this patch adds a callback to RecursivelyDeleteTriviallyDeadInstructions which can make sure the instruction about to be deleted is removed from CodeGenPrepare's data structures.

Surprised this took so long to actually happen TBH.

Diff Detail

Event Timeline

t.p.northover created this revision.Jun 4 2020, 6:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2020, 6:37 AM
hfinkel accepted this revision.Jul 2 2020, 8:45 AM
hfinkel added a subscriber: hfinkel.

LGTM

This revision is now accepted and ready to land.Jul 2 2020, 8:45 AM