[llvm] [AMDGPU] Add calling convention check in call lowering. (PR #86267)

Thomas Symalla via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 04:11:26 PDT 2024


tsymalla wrote:

> Missing test. 

Yeah, I am working towards a minimal example.

> I'd expect us to always emit the necessary parameter copies, which would often be identity copies to fold later

I'd expect that as well, but it seems mentioned change causes the removal of these copies:

Working:

```
1392B	  ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
1408B	  %78:sgpr_128 = COPY $sgpr100_sgpr101_sgpr102_sgpr103
1424B	  $sgpr0_sgpr1_sgpr2_sgpr3 = COPY %78:sgpr_128
1840B	  $sgpr30_sgpr31 = SI_CALL killed %109:sreg_64, 0, <regmask $sgpr_null $sgpr_null_hi $src_private_base $src_private_base_hi $src_private_base_lo $src_private_limit $src_private_limit_hi $src_private_limit_lo $src_shared_base $src_shared_base_hi $src_shared_base_lo $src_shared_limit $src_shared_limit_hi $src_shared_limit_lo $sgpr4 $sgpr5 $sgpr6 $sgpr7 $sgpr8 $sgpr9 $sgpr10 $sgpr11 $sgpr12 $sgpr13 $sgpr14 $sgpr15 $sgpr16 $sgpr17 $sgpr18 $sgpr19 $sgpr20 $sgpr21 $sgpr22 and 1139 more...>, implicit $sgpr0_sgpr1_sgpr2_sgpr3, 
```

Broken:
```
1520B	  ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
1536B	  $sgpr0 = COPY %0:sgpr_32
1552B	  $sgpr1 = COPY %1:sgpr_32
1568B	  $sgpr2 = COPY %2:sgpr_32
1584B	  $sgpr3 = COPY %3:sgpr_32, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr0, implicit $sgpr1, implicit $sgpr2, implicit $sgpr0_sgpr1, implicit $sgpr0_sgpr1_sgpr2, implicit $sgpr2_sgpr3
```

=> sgpr2_sgpr3 is not in the live-ins.


https://github.com/llvm/llvm-project/pull/86267


More information about the llvm-commits mailing list