Skip to content

Commit

Permalink
AMDGPU: Fix allowing immediates for tail call pseudo.
Browse files Browse the repository at this point in the history
The pseudo was using SSrc_b64, so it allowed folding immediates into
the destination operand for a tail call to null. However, this is not
a valid operand for the s_setpc_b64 this will be lowered to. Avoids
printing the operand as an invalid immediate.

Avoids a regression when tail calls are enabled in GlobalISel (somehow
tail calls to null get deleted in the DAG).
  • Loading branch information
arsenm committed Mar 21, 2021
1 parent ffde3ac commit a0f5aad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def SI_CALL : SPseudoInstSI <

// Tail call handling pseudo
def SI_TCRETURN : SPseudoInstSI <(outs),
(ins SSrc_b64:$src0, unknown:$callee, i32imm:$fpdiff),
(ins SReg_64:$src0, unknown:$callee, i32imm:$fpdiff),
[(AMDGPUtc_return i64:$src0, tglobaladdr:$callee, i32:$fpdiff)]> {
let Size = 4;
let isCall = 1;
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/MC/AMDGPU/sop1-err.s
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ s_mov_b32 s103, 1

s_mov_b64 s[102:103], -1
// VI: error: register not available on this GPU

s_setpc_b64 0
// GCN: error: invalid operand for instruction

0 comments on commit a0f5aad

Please sign in to comment.