[PATCH] [If Converter] Convert recursion to iteration

Akira Hatanaka ahatanak at gmail.com
Fri Jun 19 18:53:40 PDT 2015


I have a large program that has a CFG structure that looks like this:

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

When I compile this program targeting armv7, function IfConverter::AnalyzeBlock gets called recursively a large number of times, which eventually results in hitting the stack limit and segfaulting.

This patch changes the function to use iteration instead of recursion to avoid the segfault.

http://reviews.llvm.org/D10587

Files:
  lib/CodeGen/IfConversion.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10587.28060.patch
Type: text/x-patch
Size: 12527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150620/44f371df/attachment.bin>


More information about the llvm-commits mailing list