[llvm] [AMDGPU] Allow rematerialization of instructions with virtual register uses (PR #124327)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 19:34:03 PST 2025
================
@@ -1615,6 +1615,61 @@ void GCNSchedStage::revertScheduling() {
DAG.Regions[RegionIdx] = std::pair(DAG.RegionBegin, DAG.RegionEnd);
}
+bool PreRARematStage::allUsesAvailableAt(const MachineInstr *InstToRemat,
+ SlotIndex OriginalIdx,
+ SlotIndex RematIdx) const {
+
+ LiveIntervals *LIS = DAG.LIS;
+ MachineRegisterInfo &MRI = DAG.MRI;
+ OriginalIdx = OriginalIdx.getRegSlot(true);
+ RematIdx = std::max(RematIdx, RematIdx.getRegSlot(true));
+ for (const MachineOperand &MO : InstToRemat->operands()) {
+ if (!MO.isReg() || !MO.getReg() || !MO.readsReg())
+ continue;
+
+ // Do not attempt to reason about PhysRegs
+ if (!MO.getReg().isVirtual()) {
+ assert(DAG.MRI.isConstantPhysReg(MO.getReg()) ||
+ DAG.TII->isIgnorableUse(MO));
----------------
jrbyrnes wrote:
> It is not constant. We assign to m0 all the time, and on some targets initialize flat_scr.
Alright, sure.
The assert was meant to check that the client of function has are filtered out instructions with bad PhysReg uses (like we do after https://github.com/llvm/llvm-project/commit/e77d428e46d94e1be6e5f38205b01d3f528d5e3f ) but we can just give up on them.
https://github.com/llvm/llvm-project/pull/124327
More information about the llvm-commits
mailing list