diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/LoopVersioning.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp index 11f11adbc5e..bfc877e9836 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( |

