This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Assert if there is modification to DelBB while it is awaiting deletion
ClosedPublic

Authored by NutshellySima on Jul 24 2018, 7:42 AM.

Details

Summary

Previously, passes use

DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
DTU.deleteBB(DelBB);

to delete a BasicBlock.
But passes which don't have the ability to update DomTree (e.g. tailcallelim, simplifyCFG) cannot recognize a DelBB awaiting deletion and will continue to process this DelBB.
This is a simple approach to notify devs of passes which may use DTU in the future to deal with deleted BasicBlocks under Lazy Strategy correctly.

Diff Detail

Repository
rL LLVM

Event Timeline

NutshellySima created this revision.Jul 24 2018, 7:42 AM
kuhar added inline comments.Jul 24 2018, 8:42 AM
lib/IR/DomTreeUpdater.cpp
141 ↗(On Diff #157032)

This deserves a comment -- it's not clear why such a block would have exactly one instruction that is UnreachableInst

Address comments.

NutshellySima marked an inline comment as done.Jul 24 2018, 10:00 AM
kuhar accepted this revision.Jul 24 2018, 10:01 AM

Thanks for the comment!
LGTM.

This revision is now accepted and ready to land.Jul 24 2018, 10:01 AM
This revision was automatically updated to reflect the committed changes.

Delayed LGTM. It's a good assert to know if someone tries to alter DelBB after it's marked for deletion.