This is an archive of the discontinued LLVM Phabricator instance.

VirtRegMap: Improve addMBBLiveIns() using SlotIndex::MBBIndexIterator; NFC
ClosedPublic

Authored by MatzeB on Aug 28 2015, 11:44 AM.

Details

Summary

Now that we have an explicit iterator over the idx2MBBMap in SlotIndices
we can use the fact that segments and the idx2MBBMap are sorted by
SlotIndex position. We can advance both simultaneously instead of
starting from the beginning for each segment.

This complicates the code for the subregister case somewhat because we have to
keep a set of iterators for each subrange in sync. The result should however be
more efficient and has the advantage that we get the complete lanemask for each
block immediately instead of incrementally building it. This is important for a
subsequent change.

Removes the now unused SlotIndexes::findMBBLiveIns function.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 33451.Aug 28 2015, 11:44 AM
MatzeB retitled this revision from to VirtRegMap: Improve addMBBLiveIns() using SlotIndex::MBBIndexIterator; NFC.
MatzeB updated this object.
MatzeB added a reviewer: qcolombet.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added subscribers: atrick, llvm-commits.
qcolombet accepted this revision.Sep 8 2015, 5:21 PM
qcolombet edited edge metadata.

Hi Matthias,

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

Thanks,
-Quentin

lib/CodeGen/VirtRegMap.cpp
309

Reiterate the assumption here so that we know why we do not need to start over for each segment.

311

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?

This revision is now accepted and ready to land.Sep 8 2015, 5:21 PM

Thanks for the review. I created a separate commit that adds a check that the MBBIdxMap is sorted to the MachineVerifier (r247166).

This revision was automatically updated to reflect the committed changes.