<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The current <font face="Menlo" class="">ilist::reverse_iterator</font> is a typedef from <span style="font-family: Menlo;" class="">std::reverse_iterator<ilist::iterator></span>.  The latter is well-designed for data structures where iterators are invalidated on changes to the container (e.g., <font face="Menlo" class="">std::vector</font>).  However, its invalidation characteristics vs. its underlying iterator are unintuitive.<div class=""><br class=""></div><div class="">This comes up from time to time, most recently in a WIP patch for a loop sink pass:</div><div class="">  <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/383835.html" class="">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/383835.html</a></div><div class=""><br class=""></div><div class="">I have a patch on llvm-commits that fixes this (and I won't repeat the commit message here):</div><div class="">  <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160822/384491.html" class="">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160822/384491.html</a></div><div class=""><br class=""></div><div class="">I'm surfacing this on llvm-dev so it gets visibility of out-of-tree users.  If you have algorithms that rely on the strange invalidation semantics of <span style="font-family: Menlo;" class="">std::reverse_iterator</span>, like the patch fixes up in lib/Transforms/Scalar/LoopRerollPass.cpp, you'll need to update your code.  Unfortunately, I couldn't find a way to catch that at runtime.</div><div class=""><br class=""></div><div class="">If you're interested in testing the patch before I commit (if you don't trust the coverage of <font face="Menlo" class="">ninja check</font> for your bot), let me know in the review thread and I'll try to hold off.</div></body></html>