[PATCH] D48470: [LegacyPM] Fix PR37888 by teaching the legacy loop pass manager how to clear out deleted loops from the current queue beyond just the current loop.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 19:27:09 PDT 2018


chandlerc added inline comments.


================
Comment at: llvm/lib/Analysis/LoopPass.cpp:149
+  assert(LQ.back() == CurrentLoop && "Loop queue back isn't the current loop!");
+  LQ.erase(std::remove(LQ.begin(), LQ.end(), &L), LQ.end());
+
----------------
sanjoy wrote:
> Can we have the same loop multiple times in the loop queue?  If not would be nice to assert that and use the single iterator version of erase.
Yeah, technically... You could have two SimpleLoopUnswitch passes in the same pipeline, and because of how this works, both could run, find something to transform, transform it, and re-enqueue the loop to be processed. Then we'll end up re-visiting it twice too.

We could prevent this, but it'd take a bunch of code and doesn't seem worth it when we can just handle it here.


Repository:
  rL LLVM

https://reviews.llvm.org/D48470





More information about the llvm-commits mailing list