[PATCH] D41982: [mips] Reordering callseq* nodes to be linear
Simon Dardis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 02:22:29 PST 2018
sdardis requested changes to this revision.
sdardis added a comment.
This revision now requires changes to proceed.
This patch isn't correct, as you're not passing the pointer to the callee or filling the rest of the argument registers with the object being passed. This results in the callee and caller differing in their interpretation of the arguments. The following test case shows this behaviour:
struct S1 {
char t[32000];
};
extern void f2(char);
void f(int b, struct S1 a) {
f2(a.t[1] + (char)b) ;
}
void g(void) {
struct S1 a;
f(1, a);
}
This compiled with r310704 reverted has the correct IR in that the caller and callee agree that the second argument to f is a pointer to a byval structure argument, but g doesn't set $5 to the result of the memcpy:
addiu $4, $1, 16
addiu $1, $fp, 32016
addiu $5, $1, 12
addiu $6, $zero, 32000
jal memcpy
nop
addiu $4, $zero, 1
sw $2, 32012($fp) # 4-byte Folded Spill
jal f
nop
while f believes that the second argument is spread across $5-$7:
addiu $sp, $sp, -32
sw $ra, 28($sp) # 4-byte Folded Spill
sw $fp, 24($sp) # 4-byte Folded Spill
move $fp, $sp
sw $7, 44($fp)
sw $6, 40($fp)
sw $5, 36($fp)
sw $4, 20($fp)
lbu $4, 37($fp)
lw $5, 20($fp)
addu $4, $4, $5
seb $4, $4
jal f2
Can you take a look at this?
Repository:
rL LLVM
https://reviews.llvm.org/D41982
More information about the llvm-commits
mailing list