[llvm] [AMDGPU] Do not remat instructions with PhysReg uses (PR #124366)
    Jeffrey Byrnes via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Feb  7 11:16:15 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()) {
----------------
jrbyrnes wrote:
Fixed by https://github.com/llvm/llvm-project/pull/124327
https://github.com/llvm/llvm-project/pull/124366
    
    
More information about the llvm-commits
mailing list