[llvm] [AMDGPU] Fix DEALLOC_VGPRS in the presence of spills to scratch (PR #178461)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 08:38:59 PST 2026


================
@@ -4481,10 +4481,6 @@ bool SIInstrInfo::mayAccessScratch(const MachineInstr &MI) const {
   if ((!isFLAT(MI) || isFLATGlobal(MI)) && !isBUF(MI))
     return false;
 
-  // If scratch is not initialized, we can never access it.
-  if (MI.getMF()->getFunction().hasFnAttribute("amdgpu-no-flat-scratch-init"))
-    return false;
-
----------------
arsenm wrote:

The attribute doesn't indicate that scratch isn't used. It only requests to not initialize flat_scr, which is unnecessary if we do not need to perform a scratch->flat addrspacecast. The backend will not emit such casts for a spill



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


More information about the llvm-commits mailing list