Page MenuHomePhabricator

[NFC] Add validation to Ordered Instructions
AbandonedPublic

Authored by mkazantsev on Sep 11 2018, 3:55 AM.

Details

Summary

One more measure to prevent potential problems with dangling pointers.
This patch adds validation methods in debug mode to OrderedInstructions
and OrderedBasicBlock to make sure that we are not dealing with dangling
pointers and other data inconsistencies while working with them.

The validation is called from InstructionPrecedenceTracking whenever it
makes its own validation.

Diff Detail

Event Timeline

mkazantsev created this revision.Sep 11 2018, 3:55 AM
fhahn added a comment.Sep 11 2018, 4:07 AM

D51664 gets rid of building OrderedBasicBlocks and comes with its own validation of the ordering.

Thanks @fhahn , I haven't seen it before. Actually after studying the code I came to the same conclusions as they did (that we only need to invalidate when we insert instructions or remove blocks). The mental problem I have is the comment for this class stating that: "A OrderedBasicBlock instance should be discarded whenever the source BasicBlock changes". This, in particular, means that I can check that we don't have dangling pointers whenever we make a request to this class...

I'll go read this patch.