[PATCH] D64553: [LoopUtils] Extend the scope of getLoopEstimatedTripCount

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 20:18:14 PDT 2019


skatkov marked an inline comment as done.
skatkov added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp:640
+  SmallVector<BasicBlock *, 4> ExitBlocks;
+  L->getUniqueNonLatchExitBlocks(ExitBlocks);
+  if (any_of(ExitBlocks, [](const BasicBlock *EB) {
----------------
efriedma wrote:
> I'm seeing `Assertion 'L->hasDedicatedExits() && "getUniqueExitBlocks assumes the loop has canonical form exits!"' failed.` with some out-of-tree code that calls getLoopEstimatedTripCount.  Does this analysis really require that the loop has dedicated exits?  If it does, can we guard this call so getLoopEstimatedTripCount fails gracefully for loops without dedicated exits?
> 
> I think all the in-tree users of getLoopEstimatedTripCount require dedicated exits for other reasons, so no bug report.
Hello Eli,

getUniqueExitBlocks is written in a way that it expects that all predecessors of successor of loop's basic block is in a loop.

I totally fine to add a guard to fail gracefully. Will publish a patch in a couple of hours.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64553/new/

https://reviews.llvm.org/D64553





More information about the llvm-commits mailing list