[PATCH] D25364: [LCSSA] Use linear algorithm for isRecursivelyLCSSAForm

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 04:58:19 PDT 2016


igor-laevsky created this revision.
igor-laevsky added reviewers: philip, sanjoy, mzolotukhin, sunfish.
igor-laevsky added a subscriber: llvm-commits.

Currently 'isRecursivelyLCSSAForm' has quadratic complexity on the number of
loop basic blocks. This caused by the fact that in each recursion level we will
visit all blocks from the current loop and all of it's sub-loops. On the next
recursive call we will step into one of the sub-loops and revisit same basic blocks.
We can address that by limiting iteration only on the blocks which are located
directly in the current loop. We know that all sub-loops will be checked by the
following recursive process.

This change is motivated by the 10x slow-down on one of our internal loop
intensive tests (Release+Asserts build). It started to happen after introduction
of the additional lcssa verification - https://github.com/llvm-mirror/llvm/commit/79e702086510fa7b52de178354eab34a7f641025

Unfortunately even with this change we are still experiencing huge slow down. I think
this may be the result of calling LCSSAWrapperPass::verifyAnalysis for the whole
function for each loop. Maybe there is a way we can more efficiently structure this code?


https://reviews.llvm.org/D25364

Files:
  include/llvm/Analysis/LoopInfo.h
  lib/Analysis/LoopInfo.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  lib/Transforms/Utils/LCSSA.cpp
  lib/Transforms/Utils/LoopSimplify.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25364.73906.patch
Type: text/x-patch
Size: 6339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161007/81feb37b/attachment.bin>


More information about the llvm-commits mailing list