From 1589adf4dfc445d2f2978d837639c53241eaed09 Mon Sep 17 00:00:00 2001 From: Serguei Katkov Date: Tue, 9 Jul 2019 04:20:43 +0000 Subject: [PATCH] [LoopInfo] Update getExitEdges to accept vector of pairs for non const BasicBlock D63921 requires getExitEdges fills a vector of Edge pairs where BasicBlocks are not constant. The rest Loop API mostly returns non-const BasicBlocks, so to be more consistent with other Loop API getExitEdges is modified to return non-const BasicBlocks as well. This is an alternative solution to D64060. Reviewers: reames, fhahn Reviewed By: reames, fhahn Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D64309 llvm-svn: 365437 --- include/llvm/Analysis/LoopInfo.h | 2 +- lib/Transforms/Scalar/LoopPredication.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 572864925bc..98b31295ada 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -279,7 +279,7 @@ public: BlockT *getUniqueExitBlock() const; /// Edge type. - typedef std::pair Edge; + typedef std::pair Edge; /// Return all pairs of (_inside_block_,_outside_block_). void getExitEdges(SmallVectorImpl &ExitEdges) const; diff --git a/lib/Transforms/Scalar/LoopPredication.cpp b/lib/Transforms/Scalar/LoopPredication.cpp index a14c690d5c4..507a1e251ca 100644 --- a/lib/Transforms/Scalar/LoopPredication.cpp +++ b/lib/Transforms/Scalar/LoopPredication.cpp @@ -903,7 +903,7 @@ bool LoopPredication::isLoopProfitableToPredicate() { if (SkipProfitabilityChecks || !BPI) return true; - SmallVector, 8> ExitEdges; + SmallVector, 8> ExitEdges; L->getExitEdges(ExitEdges); // If there is only one exiting edge in the loop, it is always profitable to // predicate the loop.