Reimplement the loopsimplify code which deletes edges from unreachable
authorChris Lattner <sabre@nondot.org>
Sat, 12 Aug 2006 04:51:20 +0000 (04:51 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 12 Aug 2006 04:51:20 +0000 (04:51 +0000)
commitfa78946482a2cc73a1485887dfd12edd12b742a4
tree82854c97af4ced546f0833a4ac021be1eeb9d911
parent8731c0d234d2579766a06cbb915dfcd15490075e
Reimplement the loopsimplify code which deletes edges from unreachable
blocks that target loop blocks.

Before, the code was run once per loop, and depended on the number of
predecessors each block in the loop had.  Unfortunately, scanning preds can
be really slow when huge numbers of phis exist or when phis with huge numbers
of inputs exist.

Now, the code is run once per function and scans successors instead of preds,
which is far faster.  In addition, the new code is simpler and is goto free,
woo.

This change speeds up a nasty testcase Duraid provided me from taking hours to
taking ~72s with a debug build.  The functionality this implements is already
tested in the testsuite as Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29644 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LoopSimplify.cpp