]> granicus.if.org Git - llvm/commitdiff
[LoopInfo] Update getExitEdges to accept vector of pairs for non const BasicBlock
authorSerguei Katkov <serguei.katkov@azul.com>
Tue, 9 Jul 2019 04:20:43 +0000 (04:20 +0000)
committerSerguei Katkov <serguei.katkov@azul.com>
Tue, 9 Jul 2019 04:20:43 +0000 (04:20 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365437 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopInfo.h
lib/Transforms/Scalar/LoopPredication.cpp

index 572864925bc8cd70d148a616f140e8364846b7cb..98b31295ada082ff7525c7e02b1e48c0f922a3a9 100644 (file)
@@ -279,7 +279,7 @@ public:
   BlockT *getUniqueExitBlock() const;
 
   /// Edge type.
-  typedef std::pair<const BlockT *, const BlockT *> Edge;
+  typedef std::pair<BlockT *, BlockT *> Edge;
 
   /// Return all pairs of (_inside_block_,_outside_block_).
   void getExitEdges(SmallVectorImpl<Edge> &ExitEdges) const;
index a14c690d5c47e5309571c364dd9cde350d0befa3..507a1e251ca657cfe34f7c2d0e72365c9011a931 100644 (file)
@@ -903,7 +903,7 @@ bool LoopPredication::isLoopProfitableToPredicate() {
   if (SkipProfitabilityChecks || !BPI)
     return true;
 
-  SmallVector<std::pair<const BasicBlock *, const BasicBlock *>, 8> ExitEdges;
+  SmallVector<std::pair<BasicBlock *, BasicBlock *>, 8> ExitEdges;
   L->getExitEdges(ExitEdges);
   // If there is only one exiting edge in the loop, it is always profitable to
   // predicate the loop.