[PATCH] D100004: [SCEV] Correct handling of recurrences matched in partially unreachable code (try 2)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 20:51:58 PDT 2021


reames added a comment.

JFYI, planning on pursuing this as a style cleanup over Max's landed change, but distracted due to other events.  Will likely be a couple days before I get back to this.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5675
   auto *L = LI.getLoopFor(P->getParent());
-  assert(L && L->getHeader() == P->getParent());
-  if (!L->contains(BO->getParent()))
+  if (!L || L->getHeader() != P->getParent())
+    // If we have unreachable blocks involved, then dominance collapses and
----------------
mkazantsev wrote:
> Do we have a guarantee of having no loops in unreachable code?
See LoopInfoBase<>::analyze specififically the line:
DomTree.isReachableFromEntry(Backedge))

Note that the verify routine also checks against a newly constructed LI, so any failure to update should be caught in a expensive asserts run.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100004



More information about the llvm-commits mailing list