OSDN Git Service

[PM] Rewrite the loop pass manager to use a worklist and augmented run
authorChandler Carruth <chandlerc@gmail.com>
Wed, 11 Jan 2017 06:23:21 +0000 (06:23 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 11 Jan 2017 06:23:21 +0000 (06:23 +0000)
commitd27a39a962d108a01145667cfdfc1ff65c338b81
tree9399b2dd1a092a91e8295d5493148eca1ba69c59
parentbd496c74a2b9448967ad06c7f1b5a12c67b23698
[PM] Rewrite the loop pass manager to use a worklist and augmented run
arguments much like the CGSCC pass manager.

This is a major redesign following the pattern establish for the CGSCC layer to
support updates to the set of loops during the traversal of the loop nest and
to support invalidation of analyses.

An additional significant burden in the loop PM is that so many passes require
access to a large number of function analyses. Manually ensuring these are
cached, available, and preserved has been a long-standing burden in LLVM even
with the help of the automatic scheduling in the old pass manager. And it made
the new pass manager extremely unweildy. With this design, we can package the
common analyses up while in a function pass and make them immediately available
to all the loop passes. While in some cases this is unnecessary, I think the
simplicity afforded is worth it.

This does not (yet) address loop simplified form or LCSSA form, but those are
the next things on my radar and I have a clear plan for them.

While the patch is very large, most of it is either mechanically updating loop
passes to the new API or the new testing for the loop PM. The code for it is
reasonably compact.

I have not yet updated all of the loop passes to correctly leverage the update
mechanisms demonstrated in the unittests. I'll do that in follow-up patches
along with improved FileCheck tests for those passes that ensure things work in
more realistic scenarios. In many cases, there isn't much we can do with these
until the loop simplified form and LCSSA form are in place.

Differential Revision: https://reviews.llvm.org/D28292

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291651 91177308-0d34-0410-b5e6-96231b3b80d8
34 files changed:
include/llvm/Analysis/IVUsers.h
include/llvm/Analysis/LoopAccessAnalysis.h
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/LoopPassManager.h
include/llvm/Transforms/Scalar/IndVarSimplify.h
include/llvm/Transforms/Scalar/LICM.h
include/llvm/Transforms/Scalar/LoopDeletion.h
include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
include/llvm/Transforms/Scalar/LoopInstSimplify.h
include/llvm/Transforms/Scalar/LoopRotation.h
include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
include/llvm/Transforms/Scalar/LoopStrengthReduce.h
include/llvm/Transforms/Scalar/LoopUnrollPass.h
lib/Analysis/IVUsers.cpp
lib/Analysis/LoopAccessAnalysis.cpp
lib/Analysis/LoopInfo.cpp
lib/Analysis/LoopPass.cpp
lib/Analysis/LoopPassManager.cpp
lib/Passes/PassBuilder.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Scalar/LICM.cpp
lib/Transforms/Scalar/LoopDeletion.cpp
lib/Transforms/Scalar/LoopDistribute.cpp
lib/Transforms/Scalar/LoopIdiomRecognize.cpp
lib/Transforms/Scalar/LoopInstSimplify.cpp
lib/Transforms/Scalar/LoopRotation.cpp
lib/Transforms/Scalar/LoopSimplifyCFG.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
lib/Transforms/Scalar/LoopUnrollPass.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Other/loop-pass-ordering.ll
test/Other/new-pass-manager.ll
test/Other/pass-pipeline-parsing.ll
unittests/Analysis/LoopPassManagerTest.cpp