This is an archive of the discontinued LLVM Phabricator instance.

Don't use invalidated iterators in FlattenCFGPass
ClosedPublic

Authored by kuhar on Sep 17 2019, 11:33 AM.

Details

Summary

FlattenCFG may erase unnecessary blocks, which also invalidates iterators to those erased blocks.
Before this patch, iterativelyFlattenCFG could try to increment a BB iterator after that BB has been removed and crash.

This patch makes FlattenCFGPass use WeakVH to skip over erased blocks.

Diff Detail

Repository
rL LLVM

Event Timeline

kuhar created this revision.Sep 17 2019, 11:33 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
kuhar edited reviewers, added: sanjoy, asbirlea; removed: grosser.Sep 19 2019, 7:16 AM
This revision is now accepted and ready to land.Sep 19 2019, 10:47 AM
This revision was automatically updated to reflect the committed changes.