[llvm-dev] globalisel: cross-bank constant propagation?

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 29 06:04:18 PDT 2021



> On Mar 27, 2021, at 04:56, Jay Foad via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi Nicolai!
> 
> For simplicity our regbankselect says that all operands of VALU
> instructions have to go in vgprs. Moving some of them into sgprs is
> left as an optimisation for a later pass. As you know there are limits
> on //how many// operands of a VALU instruction can be sgprs or
> constants, which are not simple to express in terms of alternative
> operand mappings.
> 
> Thanks,
> Jay.


There are 2 issues:
1. Current RegBankSelect does not consider the uses when selecting the bank. This is a general missing optimization
2. For the AMDGPU case, I think we should have a post-regbankselect combiner for this. It’s often better to materialize constants for each bank

I don’t think we actually want to have to look through copies, and the places we do are just working around the status quo.

The folding SGPR/constants into instructions should be a new and improved version of SIFoldOperands. I think optimizing this is beyond the scope of what RegBankSelect and selection patterns. Far too much code would need to be taught to respect and preserve the constant bus limitation otherwise, so that’s why everything uses VGPRs.

-Matt


More information about the llvm-dev mailing list