HomePhabricator

Don't use invalidated iterators in FlattenCFGPass

Authored by kuhar on Sep 19 2019, 12:39 PM.

Description

Don't use invalidated iterators in FlattenCFGPass

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.

Reviewers: dblaikie, tstellar, davide, sanjoy, asbirlea, grosser

Reviewed By: asbirlea

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67672

llvm-svn: 372347

Details

Committed
kuharSep 19 2019, 12:39 PM
Reviewer
asbirlea
Differential Revision
D67672: Don't use invalidated iterators in FlattenCFGPass
Parents
rGd89f2d872df3: [Analysis] Allow -scalar-evolution-max-iterations more than once
Branches
Unknown
Tags
Unknown