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
Diff Detail
Event Timeline
Comment Actions
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.
Comment Actions
Thanks for the feedback.
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.