[llvm] AMDGPU: Add support for llvm.trap to handling of intrinsics with !nocallback (PR #175230)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 09:06:36 PST 2026


================
@@ -1407,6 +1375,17 @@ struct AAAMDGPUMinAGPRAlloc
 
         return true;
       }
+      // Trap-like intrinsics such as llvm.trap and llvm.debugtrap do not have
+      // the nocallback attribute, so the AMDGPU attributor can conservatively
+      // drop all implicitly-known inputs and AGPR allocation information. Make
+      // sure we still infer that no implicit inputs are required and that the
+      // AGPR allocation stays at zero. Trap-like intrinsics may invoke a
+      // function which requires AGPRs, so we need to check if the called
+      // function has the "trap-func-name" attribute.
+      case Intrinsic::trap:
+      case Intrinsic::debugtrap:
+      case Intrinsic::ubsantrap:
+        return !CB.hasFnAttr("trap-func-name");
----------------
arsenm wrote:

Should check callsite nocallback too 

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


More information about the llvm-commits mailing list