[llvm] [AMDGPU][Scheduler] Fix inconsistent MI slots after rematerialization revert (PR #180646)

Dark Steve via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 04:26:51 PST 2026


================
@@ -3109,30 +3085,66 @@ void PreRARematStage::finalizeGCNSchedStage() {
     commitRematerializations();
     return;
   }
+
+  // It is possible that re-scheduling lowers occupancy over the one achieved
+  // just through rematerializations, in which case we revert re-scheduling in
+  // all regions but do not roll back rematerializations.
+  const bool ShouldRollbackRemats = AchievedOcc < *TargetOcc;
+
+  // When we both need to revert re-scheduling and rollback rematerializations,
----------------
PrasoonMishra wrote:

But commitRematerializations runs after modifyRegionSchedule. If the slot is stale in-flight, wouldn't adjustLaneLiveness at [line 2150](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp#L2150) compute wrong read-undef flags?

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


More information about the llvm-commits mailing list