[llvm] [AMDGPU] Reset kill flags for multiple uses of SDWAInst Ops (PR #97135)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 22:30:56 PDT 2024


================
@@ -1184,8 +1184,17 @@ bool SIPeepholeSDWA::convertToSDWA(MachineInstr &MI,
     if (PotentialMatches.count(Operand->getParentInst()) == 0)
       Converted |= Operand->convertToSDWA(*SDWAInst, TII);
   }
+
   if (Converted) {
     ConvertedInstructions.push_back(SDWAInst);
+    auto &MRI = SDWAInst->getParent()->getParent()->getRegInfo();
+    for (MachineOperand &MO : SDWAInst->uses()) {
+      if (!MO.isReg())
+        continue;
+    
+      if (!MRI.hasOneUse(MO.getReg()))
+        MRI.clearKillFlags(MO.getReg());
----------------
arsenm wrote:

You can just unconditionally clear the kill flags. They'll just get recomputed again later (and they've been soft deprecated for a long time) 

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


More information about the llvm-commits mailing list