This patch changes LoopFlattenPass from FunctionPass to LoopNestPass.
Utilize LoopNest and let function 'Flatten' generate information from it.
Paths
| Differential D102904
[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass ClosedPublic Authored by eopXD on May 21 2021, 12:53 AM.
Details Summary This patch changes LoopFlattenPass from FunctionPass to LoopNestPass. Utilize LoopNest and let function 'Flatten' generate information from it.
Diff Detail
Event TimelineeopXD retitled this revision from [LoopNest] Change LoopFlattenPass to LoopNest pass to [LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass.May 21 2021, 2:02 AM Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript Herald added subscribers: cfe-commits, libcxx-commits, openmp-commits and 86 others. · View Herald Transcript eopXD removed reviewers: andreadb, alexander-shaposhnikov, shafik, rupprecht, jdoerfert, jhenderson, sstefan1, nicolasvasilache, herhut, rriddle, aartbik, sscalpone, ftynse, aaron.ballman, baziotis, int3, sjarus, gkm, Restricted Project, Restricted Project, Restricted Project.May 21 2021, 2:43 AM eopXD removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript eopXD removed reviewers: andreadb, alexander-shaposhnikov, shafik, rupprecht, jdoerfert, jhenderson, sstefan1, nicolasvasilache, herhut, rriddle, sscalpone, ftynse, aaron.ballman, baziotis, aartbik, int3, sjarus, gkm, Restricted Project, Restricted Project, Restricted Project. eopXD removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. Comment Actions D99149 ended up needing to use the LPMUpdater as the loops may be removed. Does the same thing need to be done here? As loop flattening does inherently remove loops. Comment Actions
Loop flattening aims to remove the inner loop of a nested loop, Thank you for spotting out the problem. Comment Actions added LPMUpdater for loop removal,
Comment Actions
I think I have misused revisitCurrentLoop here, the loop don't need to be revisited again, @dmgreen Comment Actions
Comment Actions OK. So because we only delete the inner loop, not the current one, the loop nest pass remains valid? That sounds Ok then. I think the changes from UnrollAndJam were found with a sanitizer build, so it might be worth testing it with one of those (or letting the buildbots do it post-commit, and keeping an eye one them to make sure they remain OK).
Comment Actions
I think for a LoopNestPass (or a LoopPass), the LPMUpdater is necessary parameter.
Comment Actions
I've deleted the parts for loop simplification and form LCSSA inside function Flatten, I've just commented out the 3 passes and the tests still passed when I added -enable-new-pm=0 (using the legacy pass). This revision is now accepted and ready to land.May 25 2021, 9:16 AM This revision was landed with ongoing or failed builds.May 28 2021, 12:11 AM Closed by commit rG7952ddb21fb7: [LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass (authored by eopXD). · Explain Why This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.May 28 2021, 12:25 AM This revision was landed with ongoing or failed builds.May 28 2021, 12:26 AM Closed by commit rGffc4d3e06855: [LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass (authored by eopXD). · Explain Why This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.May 28 2021, 12:27 AM eopXD added a reverting change: D103302: Revert "[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass".May 28 2021, 12:58 AM eopXD added a reverting change: rG7e06cf8f1ba2: Revert "[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass".May 28 2021, 1:06 AM eopXD added a reverting change: rGe96d6f4821bf: Revert "[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass". Comment Actions Remove declaration of LoopUnrollAndJam as a FunctionPass. Previously I resolved the merge conflict incorrecly. This revision was landed with ongoing or failed builds.May 28 2021, 8:43 AM Closed by commit rGfa488ea864ab: [LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass (authored by eopXD). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 346952 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/Scalar/LoopFlatten.cpp
|
clang-format: please reformat the code