[llvm] fecf067 - [AMDGPU] Add EXPENSIVE_CHECK into GCNRPTracker::reset

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 23:42:38 PDT 2022


Author: Valery Pykhtin
Date: 2022-10-28T08:42:21+02:00
New Revision: fecf067db40ffa1a6d5d665769c90cd29547f502

URL: https://github.com/llvm/llvm-project/commit/fecf067db40ffa1a6d5d665769c90cd29547f502
DIFF: https://github.com/llvm/llvm-project/commit/fecf067db40ffa1a6d5d665769c90cd29547f502.diff

LOG: [AMDGPU] Add EXPENSIVE_CHECK into GCNRPTracker::reset

This would check if passed in live-ins registers match those calculated using LIS.

This check currently breaks 420 lit tests when enabled.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D136860

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/GCNRegPressure.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index 2f38f7f65f80..e0059e6b51cf 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -260,6 +260,22 @@ void GCNRPTracker::reset(const MachineInstr &MI,
   }
 
   MaxPressure = CurPressure = getRegPressure(*MRI, LiveRegs);
+
+  LLVM_DEBUG(dbgs() << "\nReset " << (After ? "after" : "before") << ": " << MI
+                    << print(LiveRegs, *MRI));
+#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
+  if (LiveRegsCopy) {
+    auto LISLRS =
+        After ? getLiveRegsAfter(MI, LIS) : getLiveRegsBefore(MI, LIS);
+    if (!isEqual(LISLRS, *LiveRegsCopy)) {
+      dbgs() << "RP mismatch: "
+             << reportMismatch(LISLRS, *LiveRegsCopy,
+                               MRI->getTargetRegisterInfo());
+      llvm_unreachable("GCNRPTracker::reset LiveRegsCopy doens't match those "
+                       "calculated by LIS");
+    }
+  }
+#endif
 }
 
 void GCNUpwardRPTracker::reset(const MachineInstr &MI,


        


More information about the llvm-commits mailing list