This is an archive of the discontinued LLVM Phabricator instance.

[RegAlloc, NFC] Extract LastSplitPoint computation to a new class
ClosedPublic

Authored by wmi on May 6 2016, 11:47 AM.

Details

Reviewers
qcolombet
MatzeB
Summary

This is a preparing patch for http://reviews.llvm.org/D19884

Because both split and spill hoisting want to use LastSplitPoint computation result, extract the LastSplitPoint computation from SplitAnalysis class which also contains a bunch of other analysises only related to split.

Diff Detail

Repository
rL LLVM

Event Timeline

wmi updated this revision to Diff 56443.May 6 2016, 11:47 AM
wmi retitled this revision from to [RegAlloc, NFC] Extract LastSplitPoint computation to a new class.
wmi updated this object.
wmi added reviewers: qcolombet, MatzeB.
wmi set the repository for this revision to rL LLVM.
wmi added subscribers: llvm-commits, davidxl, echristo.
wmi updated this revision to Diff 56444.May 6 2016, 11:53 AM

change computeLastSplitPoint to private.

MatzeB added inline comments.May 6 2016, 12:01 PM
lib/CodeGen/SplitKit.h
41–44

This explanation of the purpose of this class is confusing. This is not about liverange splitting (liverange splitting just happens to be one of the users later). The analysis simply determines the latest point in a block in which we can insert an instruction (that reads CurLI).

47

VirtRegMap is not used here.

50

Three slashes for doxygen comments.

61

Use const LiveInterval& in the API, as nullptr is not allowed here.

63

I'd suggest using const MachineBasicBlock& instead of block numbers in the API here. That is simpler to use and you can get away without storing a reference to the MachineFunction in the LSplitPointAnalysis class.

76

Use const MachineBasicBlock& in the API as nullptr is not allowed here.

217

no need for two empty lines.

wmi added a comment.May 6 2016, 3:14 PM

Address Matthias's comments.

lib/CodeGen/SplitKit.h
41–44

I renamed LSplitPointAnalysis to InsertPointAnalysis and changed related fields and comments.

47

Removed.

50

Fixed.

61

CurLI is usually not initialized when constructor is called. It is setup in the process of split/spill and reset from time to time. So I feel const LiveInterval *CurLI is easier here.

63

Done.

76

Done.

217

Fixed.

wmi updated this revision to Diff 56472.May 6 2016, 3:16 PM
MatzeB accepted this revision.May 9 2016, 10:04 AM
MatzeB edited edge metadata.

LGTM with 1 nitpick.

Please do not push this patch until http://reviews.llvm.org/D19884 is accepted.

lib/CodeGen/SplitKit.h
124

Use three slash doxygen comment.

This revision is now accepted and ready to land.May 9 2016, 10:04 AM

Looking at the use in D19884 this may need a reset(const LiveIntervalAnalysis&) method that clears the cache and re-initializes the LiveIntervalAnalysis field, so users do not need to create new instances of the object less often.

wmi updated this revision to Diff 56939.May 11 2016, 10:52 AM
wmi edited edge metadata.

Rebase the patch.

MatzeB closed this revision.Jul 20 2016, 8:15 PM

This was committed a while ago in r269248