[PATCH] D64309: [LoopInfo] Update getExitEdges to accept vector of pairs for non const BasicBlock

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 7 22:37:35 PDT 2019


skatkov created this revision.
skatkov added reviewers: reames, fhahn.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
skatkov added a child revision: D63921: [Loop Peeling] Add support for peeling of loops with multiple exits.

D63921 <https://reviews.llvm.org/D63921> requires getExitEdges fills a vector of Edge pairs where
BasicBlocks are not constant.

This is an alternative solution to D64060 <https://reviews.llvm.org/D64060>


https://reviews.llvm.org/D64309

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


Index: llvm/lib/Transforms/Scalar/LoopPredication.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopPredication.cpp
+++ llvm/lib/Transforms/Scalar/LoopPredication.cpp
@@ -902,7 +902,7 @@
   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.
Index: llvm/include/llvm/Analysis/LoopInfo.h
===================================================================
--- llvm/include/llvm/Analysis/LoopInfo.h
+++ llvm/include/llvm/Analysis/LoopInfo.h
@@ -279,7 +279,7 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64309.208319.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/de95c04d/attachment.bin>


More information about the llvm-commits mailing list