[llvm] [AMDGPU] Do not remat instructions with PhysReg uses (PR #124366)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 03:31:31 PST 2025
================
@@ -1842,15 +1842,23 @@ bool PreRARematStage::sinkTriviallyRematInsts(const GCNSubtarget &ST,
return true;
}
-// Copied from MachineLICM
bool PreRARematStage::isTriviallyReMaterializable(const MachineInstr &MI) {
if (!DAG.TII->isTriviallyReMaterializable(MI))
return false;
- for (const MachineOperand &MO : MI.all_uses())
+ for (const MachineOperand &MO : MI.all_uses()) {
if (MO.getReg().isVirtual())
return false;
+ // We can't remat physreg uses, unless it is a constant or an ignorable
+ // use (e.g. implicit exec use on VALU instructions)
+ if (MO.getReg().isPhysical()) {
----------------
jayfoad wrote:
You already know it's not virtual because of the "if" above.
https://github.com/llvm/llvm-project/pull/124366
More information about the llvm-commits
mailing list