[llvm] [AMDGPU][Scheduler] Refactor VGPR rematerialization during scheduling (PR #118722)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 05:58:51 PST 2024
================
@@ -1671,6 +1667,20 @@ void PreRARematStage::sinkTriviallyRematInsts(
ImpactedRegions[Remat.DefRegion] = true;
}
+ // Clean up the IR; remove rematerialized instructions from state.
+ for (auto &[NewMI, OldMI] : InsertedMIToOldDef) {
+ // Remove rematerialized instruction from BBLiveInMap since we are sinking
+ // it from its MBB.
+ DAG.BBLiveInMap.erase(OldMI);
+
+ // Remove the rematerialized instruction and update live intervals.
+ Register Reg = NewMI->getOperand(0).getReg();
+ DAG.LIS->RemoveMachineInstrFromMaps(*OldMI);
+ OldMI->eraseFromParent();
+ DAG.LIS->removeInterval(Reg);
+ DAG.LIS->createAndComputeVirtRegInterval(Reg);
----------------
arsenm wrote:
Is it possible to spot fix the interval instead of computing from scratch
https://github.com/llvm/llvm-project/pull/118722
More information about the llvm-commits
mailing list