diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2018-04-23 12:33:31 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-04-23 12:33:31 +0000 |
commit | 91f481665ed06bcea86b7e01a094a9f0718faec4 (patch) | |
tree | a9adca4a30763b552a22deb3bfcbd3f175902c6c /llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | |
parent | 0a334a866879b6a19b5b123f240416e5d89b8d50 (diff) | |
download | llvm-91f481665ed06bcea86b7e01a094a9f0718faec4.zip llvm-91f481665ed06bcea86b7e01a094a9f0718faec4.tar.gz llvm-91f481665ed06bcea86b7e01a094a9f0718faec4.tar.bz2 |
[LoopRotate] Fix incorrect SCEV invalidation in loop rotation
LoopRotate only invalidates innermost loops while the changes that it makes may
also affert any of this parents. With patch rL329047, SCEV becomes much smarter
about calculation of exit counts for outer loops, so we cannot assume that they are
not affected.
Differential Revision: https://reviews.llvm.org/D45945
llvm-svn: 330582
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopRotationUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index d96c101..d2a2e40 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -259,9 +259,10 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { return false; // Anything ScalarEvolution may know about this loop or the PHI nodes - // in its header will soon be invalidated. + // in its header will soon be invalidated, and it can also affect its parent + // loops as well. if (SE) - SE->forgetLoop(L); + SE->forgetTopmostLoop(L); DEBUG(dbgs() << "LoopRotation: rotating "; L->dump()); @@ -476,6 +477,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { DEBUG(dbgs() << "LoopRotation: into "; L->dump()); +#ifndef NDEBUG + // Make sure that after all our transforms SE is correct. + if (SE) + SE->verify(); +#endif + ++NumRotated; return true; } |