aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopVersioning.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2015-08-20 17:22:29 +0000
committerAdam Nemet <anemet@apple.com>2015-08-20 17:22:29 +0000
commite48134093df8db0c0bf41079d19f8fa785ed4f05 (patch)
tree3162f95a883779bc76a454170481e142644f3a06 /llvm/lib/Transforms/Utils/LoopVersioning.cpp
parentbf17009a9739f9060bb0ba08a1123c3d2c024969 (diff)
downloadllvm-e48134093df8db0c0bf41079d19f8fa785ed4f05.zip
llvm-e48134093df8db0c0bf41079d19f8fa785ed4f05.tar.gz
llvm-e48134093df8db0c0bf41079d19f8fa785ed4f05.tar.bz2
[LVer] Fix FIXME: hide addPHINodes, NFC
Since Ashutosh made findDefsUsedOutsideOfLoop public, we can clean this up. Now clients that don't compute DefsUsedOutsideOfLoop can just call versionLoop() and computing DefsUsedOutsideOfLoop will happen implicitly. With that there is no reason to expose addPHINodes anymore. Ashutosh, you can now drop the calls to findDefsUsedOutsideOfLoop and addPHINodes in LVerLICM and things should just work. llvm-svn: 245579
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopVersioning.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
index 11f11ad..bfc877e 100644
--- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp
+++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
@@ -40,7 +40,8 @@ LoopVersioning::LoopVersioning(const LoopAccessInfo &LAInfo, Loop *L,
assert(L->getLoopPreheader() && "No preheader");
}
-void LoopVersioning::versionLoop() {
+void LoopVersioning::versionLoop(
+ const SmallVectorImpl<Instruction *> &DefsUsedOutside) {
Instruction *FirstCheckInst;
Instruction *MemRuntimeCheck;
// Add the memcheck in the original preheader (this is empty initially).
@@ -77,6 +78,10 @@ void LoopVersioning::versionLoop() {
// The loops merge in the original exit block. This is now dominated by the
// memchecking block.
DT->changeImmediateDominator(VersionedLoop->getExitBlock(), MemCheckBB);
+
+ // Adds the necessary PHI nodes for the versioned loops based on the
+ // loop-defined values used outside of the loop.
+ addPHINodes(DefsUsedOutside);
}
void LoopVersioning::addPHINodes(