[llvm] r267671 - [Cloning] cloneLoopWithPreheader(): add assert to ensure no sub-loops
Vaivaswatha Nagaraj via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 22:25:10 PDT 2016
Author: vaivaswatha
Date: Wed Apr 27 00:25:09 2016
New Revision: 267671
URL: http://llvm.org/viewvc/llvm-project?rev=267671&view=rev
Log:
[Cloning] cloneLoopWithPreheader(): add assert to ensure no sub-loops
Summary:
cloneLoopWithPreheader() does not update LoopInfo for sub-loop of
the original loop being cloned. Add assert to ensure no sub-loops for loop being cloned.
Reviewers: anemet, ashutosh.nema, hfinkel
Subscribers: mzolotukhin, llvm-commits
Differential Revision: http://reviews.llvm.org/D15922
Modified:
llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=267671&r1=267670&r2=267671&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Wed Apr 27 00:25:09 2016
@@ -221,6 +221,7 @@ bool InlineFunction(CallSite CS, InlineF
///
/// Updates LoopInfo and DominatorTree assuming the loop is dominated by block
/// \p LoopDomBB. Insert the new blocks before block specified in \p Before.
+/// Note: Only innermost loops are supported.
Loop *cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB,
Loop *OrigLoop, ValueToValueMapTy &VMap,
const Twine &NameSuffix, LoopInfo *LI,
Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=267671&r1=267670&r2=267671&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Wed Apr 27 00:25:09 2016
@@ -672,6 +672,8 @@ Loop *llvm::cloneLoopWithPreheader(Basic
const Twine &NameSuffix, LoopInfo *LI,
DominatorTree *DT,
SmallVectorImpl<BasicBlock *> &Blocks) {
+ assert(OrigLoop->getSubLoops().empty() &&
+ "Loop to be cloned cannot have inner loop");
Function *F = OrigLoop->getHeader()->getParent();
Loop *ParentLoop = OrigLoop->getParentLoop();
More information about the llvm-commits
mailing list