[PATCH] D62411: LiveIntervals: add LiveRange::findIndexesLiveAt function - return a list of SlotIndexes the LiveRange live at.

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 11:22:54 PDT 2019


vpykhtin marked 2 inline comments as done.
vpykhtin added inline comments.


================
Comment at: include/llvm/CodeGen/LiveInterval.h:612-613
+    template <typename Range>
+    std::vector<SlotIndex> findIndexesLiveAt(Range &&R) const {
+      std::vector<SlotIndex> IndexesLiveAt;
+      auto I = R.begin(), E = R.end();
----------------
arsenm wrote:
> Probably should use a SmallVectorImpl out argument
I used std::vector to be able to search again: it can be used for example to search from subranges after a search in the main range. I'm not sure SmallVector has compatible random access iterators with std::upper/lower_bound. I also dislike that every access to SmallVector requires a check whether it is allocated or not.

BTW I just realized that I want resulting array to be ascending sorted for that reason and it is currently so by the implentation.


================
Comment at: include/llvm/CodeGen/LiveInterval.h:616-618
+        auto Lower = std::lower_bound(I, E, S.start);
+        if (Lower == E)
+          break;
----------------
arsenm wrote:
> Aren't the segment sorted already, so you should be able to restrict the search bounds?
It is restricted for that reason already: upper bound starts from Lower and next iteration starts from Upper.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62411





More information about the llvm-commits mailing list