[llvm] [LLVM] Make s_getpc_b64 rematerializable (PR #71823)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 09:05:51 PST 2023


jayfoad wrote:

> I found two places that can code-generate an S_GETPC_B64, one in function SIInstrInfo::insertIndirectBranch() and one in function SIInstrInfo::expandPostRAPseudo(). I think that both of these are happening after register allocation, so at that point rematerialization can not be done.

Right. Rematerializing getpc is a weird case, because the rematerialized instruction will definitely _not_ have the same result as the original instruction. But I guess the only reasonable use of getpc (pre-RA) is calling the intrinsic llvm.amdgc.s.getpc and then extracting the high 32 bits of the result, which should be safe.

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


More information about the llvm-commits mailing list