Page MenuHomePhabricator

[LICM] Add a maximum for the number of instructions to be hoisted
AbandonedPublic

Authored by SjoerdMeijer on Dec 2 2020, 8:51 AM.

Details

Summary

LICM does not have any restrictions on the number memory instructions that is hoisting. Because it doesn't take any register pressure into consideration while doing this, we see cases with massive spilling/reloading. This is a first step attempt to control this by adding an option so that this maximum can be a user specified value, or calculated/estimated. For now, if it isn't user-specified, we initialise it to the number of scalar registers, but we should definitely follow up on this try and come up with something smarter.

Diff Detail

Event Timeline

SjoerdMeijer created this revision.Dec 2 2020, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2020, 8:51 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
SjoerdMeijer requested review of this revision.Dec 2 2020, 8:51 AM
SjoerdMeijer edited the summary of this revision. (Show Details)Dec 2 2020, 8:53 AM
fhahn added a subscriber: fhahn.Dec 7 2020, 8:41 AM
reames requested changes to this revision.Dec 7 2020, 11:21 AM

Hard reject. This patch will not be accepted. This is a major design change.

Hoisting operations out of loops is treated as a canonicalization transform in LLVM. If the register pressure is problematic, the MachineLICM pass is supposed to undo the transformation. If you have cases where that is not happening, please explore why.

If after doing so, you still feel this is the right approach, please raise the design change on llvm-dev.

This revision now requires changes to proceed.Dec 7 2020, 11:21 AM
davide removed a reviewer: davide.Dec 7 2020, 11:22 AM

Hard reject. This patch will not be accepted. This is a major design change.

Hoisting operations out of loops is treated as a canonicalization transform in LLVM. If the register pressure is problematic, the MachineLICM pass is supposed to undo the transformation. If you have cases where that is not happening, please explore why.

If after doing so, you still feel this is the right approach, please raise the design change on llvm-dev.

+1

Thanks for the feedback.

Hard reject. This patch will not be accepted. This is a major design change.

Hoisting operations out of loops is treated as a canonicalization transform in LLVM.

I have documented this in https://reviews.llvm.org/rG1e260f955d31.

If the register pressure is problematic, the MachineLICM pass is supposed to undo the transformation. If you have cases where that is not happening, please explore why.

Thanks for the pointer, will do.

SjoerdMeijer abandoned this revision.Dec 8 2020, 4:03 AM