forked from OSchip/llvm-project
[SimplifyCFG] Sanity assert in iterativelySimplifyCFG
We observe a hang within iterativelySimplifyCFG due to infinite loop execution. Currently, there is no limit to this loop, so in case of bug it just works forever. This patch adds an assert that will break it after 1000 iterations if it didn't converge.
This commit is contained in:
parent
e6df795759
commit
a9b0776a81
|
@ -224,7 +224,11 @@ static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI,
|
|||
SmallVector<WeakVH, 16> LoopHeaders(UniqueLoopHeaders.begin(),
|
||||
UniqueLoopHeaders.end());
|
||||
|
||||
unsigned IterCnt = 0;
|
||||
(void)IterCnt;
|
||||
while (LocalChange) {
|
||||
assert(IterCnt++ < 1000 &&
|
||||
"Sanity: iterative simplification didn't converge!");
|
||||
LocalChange = false;
|
||||
|
||||
// Loop over all of the basic blocks and remove them if they are unneeded.
|
||||
|
|
Loading…
Reference in New Issue