[PATCH] D57221: [LoopSimplifyCFG] Change logic of dead loops removal to avoid hitting asserts

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 25 02:12:16 PST 2019


uabelho added a comment.

It solves the problem I saw, thanks!

The change looks fine to me but I don't know this code so let someone else ok it.



================
Comment at: lib/Transforms/Scalar/LoopSimplifyCFG.cpp:408-409
+        Loop *DL = LI.getLoopFor(BB);
+        if (DL->getParentLoop()) {
+          for (auto *PL = DL->getParentLoop(); PL; PL = PL->getParentLoop())
+            for (auto *BB : DL->getBlocks())
----------------
Perhaps replace

        if (DL->getParentLoop()) {
          for (auto *PL = DL->getParentLoop(); PL; PL = PL->getParentLoop())

with

        while (auto *PL = DL->getParentLoop()) {

?


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

https://reviews.llvm.org/D57221





More information about the llvm-commits mailing list