This patch builds on top of D37065.
The test changes definitely need someone else to look over them - I'm not familiar with AMDGPU assembly. I need to return to call-argument-types.ll, I just couldn't seem to get it to pass despite the fact the test patterns seemed fine in relation to the generated output (I must be missing something obvious, will look again).