aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopVersioning.cpp
diff options
context:
space:
mode:
authorTaWeiTu <tu.da.wei@gmail.com>2020-10-24 21:39:42 +0800
committerTaWeiTu <tu.da.wei@gmail.com>2020-10-24 21:40:46 +0800
commit060a4fccf101b120cc9c36d4aa1041ee07044766 (patch)
tree95abe68e306bbbcfab4202b6268daaf21b0b04b5 /llvm/lib/Transforms/Utils/LoopVersioning.cpp
parente9955b0843cc1e5876430f3f051494d4197419f3 (diff)
downloadllvm-060a4fccf101b120cc9c36d4aa1041ee07044766.zip
llvm-060a4fccf101b120cc9c36d4aa1041ee07044766.tar.gz
llvm-060a4fccf101b120cc9c36d4aa1041ee07044766.tar.bz2
[LoopVersioning] Form dedicated exits for versioned loop to preserve simplify form
The exit blocks of the versioned and non-versioned loops are not dedicated and thus the two loops are not in simplify form. Insert dummy exit blocks after loop versioning with `formDedicatedExits()` to preserve the simplify form for subsequence passes. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D89569
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopVersioning.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
index f3170a1..03eb41b 100644
--- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp
+++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
@@ -117,6 +117,11 @@ void LoopVersioning::versionLoop(
// Adds the necessary PHI nodes for the versioned loops based on the
// loop-defined values used outside of the loop.
addPHINodes(DefsUsedOutside);
+ formDedicatedExitBlocks(NonVersionedLoop, DT, LI, nullptr, true);
+ formDedicatedExitBlocks(VersionedLoop, DT, LI, nullptr, true);
+ assert(NonVersionedLoop->isLoopSimplifyForm() &&
+ VersionedLoop->isLoopSimplifyForm() &&
+ "The versioned loops should be in simplify form.");
}
void LoopVersioning::addPHINodes(