[llvm] [AMDGPU][Scheduler] Prepare remat stage for rematerializer integration (NFC) (PR #189489)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 06:07:12 PDT 2026


================
@@ -424,6 +424,17 @@ bool GCNRPTarget::isSaveBeneficial(Register Reg) const {
   return (UnifiedRF && Excess.VGPR) || Excess.ArchVGPR;
 }
 
+bool GCNRPTarget::isSaveBeneficial(const GCNRegPressure &SaveRP) const {
+  RegExcess Excess(MF, RP, *this);
+  if (SaveRP.getSGPRNum() && Excess.SGPR)
----------------
lucas-rami wrote:

> Avoid the implicit conversion to bool

Done.

> I would also expect this to be a function of the number of SGPRs if you're tracking a count?

This particular function is just determining whether at least one useful register will be saved, so for each class with excess I just want to check whether any register of that class will be saved. `GCNRPTarget::getNumRegsBenefit` is structurally identical to this function but tracks the actual number of useful saved registers.

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


More information about the llvm-commits mailing list