[PATCH] D12443: VirtRegMap: Improve addMBBLiveIns() using SlotIndex::MBBIndexIterator; NFC

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 17:21:11 PDT 2015


qcolombet accepted this revision.
qcolombet added a comment.
This revision is now accepted and ready to land.

Hi Matthias,

LGTM with maybe an additional comment and an assert.
See the inlined comments.

Thanks,
-Quentin


================
Comment at: lib/CodeGen/VirtRegMap.cpp:309
@@ +308,3 @@
+      // Go over MBB begin positions and see if we have segments covering them.
+      SlotIndexes::MBBIndexIterator I = Indexes->MBBIndexBegin();
+      for (const auto &Seg : LI) {
----------------
Reiterate the assumption here so that we know why we do not need to start over for each segment.

================
Comment at: lib/CodeGen/VirtRegMap.cpp:311
@@ +310,3 @@
+      for (const auto &Seg : LI) {
+        I = Indexes->advanceMBBIndex(I, Seg.start);
+        for (; I != Indexes->MBBIndexEnd() && I->first < Seg.end; ++I) {
----------------
I do not remember if we check that somewhere, like the machine verifier, but I guess it won’t hurt to have an assert to check that the list is indeed sorted.

What do you think?


Repository:
  rL LLVM

http://reviews.llvm.org/D12443





More information about the llvm-commits mailing list