[llvm] [AMDGPU] Fix machine verification failure after SIFoldOperandsImpl::tryFoldOMod (PR #113544)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 15:41:28 PDT 2024


================
@@ -1793,6 +1793,12 @@ bool SIFoldOperandsImpl::tryFoldOMod(MachineInstr &MI) {
 
   DefOMod->setImm(OMod);
   MRI->replaceRegWith(MI.getOperand(0).getReg(), Def->getOperand(0).getReg());
+  if (Def->getParent() != MI.getParent()) {
+    // Kill flags can be wrong if we replaced a def inside a loop with a def
+    // outside the loop.
+    for (auto &Use : MRI->use_nodbg_operands(Def->getOperand(0).getReg()))
----------------
arsenm wrote:

MRI->clearKillFlags 

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


More information about the llvm-commits mailing list