[PATCH] D88880: [IndVarSimplify] Add loop-flattening
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 06:22:52 PDT 2020
SjoerdMeijer updated this revision to Diff 298615.
SjoerdMeijer retitled this revision from "[LoopFlatten] Initial support for different types" to "[IndVarSimplify] Add loop-flattening".
SjoerdMeijer added a comment.
Herald added a subscriber: mgorny.
I've got a slightly different proposal. This moves the loop flatten pass into IndVarSimplify for several reasons:
- loop-flatten is best run just before IndVarSimplify because IndVarSimplify can promote induction variables. For overflow analysis to see if loop flattening is legal, it's best if inductions variables haven't been promoted yet.
- When induction variables of a loop nest don't use the maximum legal integer type, we promote them to the widest type so we know loop flattening is safe thus avoiding overflow analysis. Promoting induction variables is what IndVarSimplify was already doing, so this reusing that.
- Last but not least, with the loops that we support with loop-flattening, induction variable simplification is exactly the point of this transform, so this looks like a good home for it. Thus, this also avoids quite some churn making modifications to LoopUtils where refactored/shared code could live, and in both of the passes.
This is still work-in-progress, but wanted to share the idea already. This needs porting of the existing loopflatten tests, and I need to fix a bug/integration issue, but in terms of (re)structuring this should be pretty much it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88880/new/
https://reviews.llvm.org/D88880
Files:
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Scalar.h
llvm/include/llvm/Transforms/Scalar/LoopFlatten.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/lib/Transforms/Scalar/CMakeLists.txt
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
llvm/lib/Transforms/Scalar/Scalar.cpp
llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88880.298615.patch
Type: text/x-patch
Size: 61219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/4962de85/attachment-0001.bin>
More information about the llvm-commits
mailing list