[PATCH] D96980: [amdgpu] Revert agnostic SGPR spill.

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 4 00:40:23 PST 2021


sebastian-ne added a comment.

I think I found a way how exec can get zero before a restore (disclaimer: I’m not sure if that is valid code in any of the graphics APIs or if something similar can happen in compute. It should be valid LLVM IR, however).
Imagine the following pseudocode:

  function main() {
    // exec = 0xff
    if (<divergent condition>) {
      // exec = 0xf0
      foo();
    }
    // continue doing things
  }
  
  function foo() {
    // exec = 0xf0
    <spill s0>
  
    // Kills all currently active lanes
    // However, more lanes are active outside the call, so we can’t s_endpgm
    llvm.amdgcn.kill(false);
  
    // exec = 0x00
    // We still need to restore s0 (if it is a callee-save register)
    <restore s0>
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96980/new/

https://reviews.llvm.org/D96980



More information about the llvm-commits mailing list