efriedma added a comment.
On a sort-of-related note, we currently miscompile the following:
void a(int (*p)(int,int,int,int)) {
register int (*x)(int,int,int,int) asm("r0") = p;
asm("ldr r0, =g":"=r"(x));
x(1,2,3,4);
}
https://reviews.llvm.org/D40706