> On 7/29/2026 1:20 AM, Jin Ma wrote: > > MI thunks generate RTL as if reload were complete and emit it directly > > without running register allocation. Creating a pseudo while > > materializing an invalid sibcall address therefore triggers the > > gen_reg_rtx assertion. > > > > Use STATIC_CHAIN_REGNUM for this post-reload thunk path. It is available > > as a temporary in MI thunks and belongs to SIBCALL_REGS. Keep using a > > pseudo for sibcalls expanded before register allocation. > > > > PR target/126449 > > > > gcc/ChangeLog: > > > > * config/riscv/riscv.cc (riscv_legitimize_call_address): Use > > STATIC_CHAIN_REGNUM when a sibcall address is materialized in > > post-reload thunk code. > > > > gcc/testsuite/ChangeLog: > > > > * g++.target/riscv/pr126449.C: New test. > Yea, for thunks we really need to use a physical register. Others bury > this in their output_mi_thunk routine, but the net is the same. > > OK. Thanks for chasing this down. > > jeff
Pushed to trunk :) BR, Jin Ma
