diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -57,6 +57,7 @@ class StoreInst; class TargetLibraryInfo; class TargetTransformInfo; +class LoopInfo; //===----------------------------------------------------------------------===// // Local constant propagation. @@ -189,7 +190,8 @@ /// true, sink any common code from the predecessors to BB. /// We also allow one predecessor to end with conditional branch (but no more /// than one). -bool sinkCommonCodeFromPredecessors(BasicBlock *BB, DomTreeUpdater *DTU); +bool sinkCommonCodeFromPredecessors(BasicBlock *BB, DomTreeUpdater *DTU, + LoopInfo *LI = nullptr); /// This function is used to flatten a CFG. For example, it uses parallel-and /// and parallel-or mode to collapse if-conditions and merge if-regions with diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1926,7 +1926,8 @@ // true, sink any common code from the predecessors to BB. // We also allow one predecessor to end with conditional branch (but no more // than one). -bool llvm::sinkCommonCodeFromPredecessors(BasicBlock *BB, DomTreeUpdater *DTU) { +bool llvm::sinkCommonCodeFromPredecessors(BasicBlock *BB, DomTreeUpdater *DTU, + LoopInfo *LI) { // We support two situations: // (1) all incoming arcs are unconditional // (2) one incoming arc is conditional @@ -2044,7 +2045,7 @@ LLVM_DEBUG(dbgs() << "SINK: Splitting edge\n"); // We have a conditional edge and we're going to sink some instructions. // Insert a new block postdominating all blocks we're going to sink from. - if (!SplitBlockPredecessors(BB, UnconditionalPreds, ".sink.split", DTU)) + if (!SplitBlockPredecessors(BB, UnconditionalPreds, ".sink.split", DTU, LI)) // Edges couldn't be split. return false; Changed = true;