[llvm-dev] Dealing with illegal operand mappings in RegBankSelect
Arsenault, Matthew via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 20 16:49:38 PST 2019
Some operations on AMDGPU require operands which must be in a register bank that is impossible to copy from another. The operation needs to be rewritten in a complex way to avoid the illegal copy.
Currently if I correctly report the required register banks in the operand mapping, RegBankSelect happily inserts the illegal copies, somehow concluding they are cheap (I would at least hope there’s an assert or something). So far I’ve worked around this by lying and reporting all of the invalid source register banks as legal. applyMapping then checks these registers and creates the new vregs and rewrites as necessary. Is this the way this is intended to work? This sort of makes sense, since it is legal in the sense that applyMapping can deal with it. The cases that need to be rewritten can then have a very high, but not impossible cost in the case of getInstrAlternativeMappings.
Lying about the actually legal banks seems counterintuitive to me. Should there be something like a new RepairingPlacement type for this to just create the vregs without inserting the copy?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev