[If Converter] Convert recursion to iteration.
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 24 Jun 2015 20:34:35 +0000 (20:34 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 24 Jun 2015 20:34:35 +0000 (20:34 +0000)
commit45dc32257e2f50806f7aed292e653dc7e833d6c3
treea9e819df480d4caf92e523415be97f290b35c6ec
parentf79d253a3ea33ce7242d22c1e9965c13fde32340
[If Converter] Convert recursion to iteration.

This commit makes changes to IfConverter::AnalyzeBlock to use iteration instead
of recursion. Previously, this function would get called recursively a large
number of times and eventually segfault when a function with the following CFG
was compiled:

BB0:
 if (condition0)
  goto BB1
 goto BB2
BB1:
 goto BB2
BB2:
 if (condition1)
  goto BB3
 goto BB4
BB3:
...
(repeat until BB7488)

rdar://problem/21386145

Differential Revision: http://reviews.llvm.org/D10587

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240589 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/IfConversion.cpp