[PATCH] D151314: [RegisterCoalescer] Fix updating LiveIntervals in joinReservedPhysReg

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 04:09:47 PDT 2023


foad updated this revision to Diff 525104.
foad added a comment.

Blank line


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151314/new/

https://reviews.llvm.org/D151314

Files:
  llvm/lib/CodeGen/RegisterCoalescer.cpp
  llvm/test/CodeGen/AArch64/regcoal-physreg.mir


Index: llvm/test/CodeGen/AArch64/regcoal-physreg.mir
===================================================================
--- llvm/test/CodeGen/AArch64/regcoal-physreg.mir
+++ llvm/test/CodeGen/AArch64/regcoal-physreg.mir
@@ -1,4 +1,4 @@
-# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing,simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
 --- |
   declare void @f2()
 
Index: llvm/lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -2196,6 +2196,7 @@
     //   ...
     //   use %physreg_x
     CopyMI = MRI->getVRegDef(SrcReg);
+    deleteInstr(CopyMI);
   } else {
     // VReg is copied into physreg:
     //   %y = def
@@ -2240,6 +2241,8 @@
                       << printReg(DstReg, TRI) << " at " << CopyRegIdx << "\n");
 
     LIS->removePhysRegDefAt(DstReg.asMCReg(), CopyRegIdx);
+    deleteInstr(CopyMI);
+
     // Create a new dead def at the new def location.
     for (MCRegUnitIterator UI(DstReg, TRI); UI.isValid(); ++UI) {
       LiveRange &LR = LIS->getRegUnit(*UI);
@@ -2247,8 +2250,6 @@
     }
   }
 
-  deleteInstr(CopyMI);
-
   // We don't track kills for reserved registers.
   MRI->clearKillFlags(CP.getSrcReg());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151314.525104.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/64418bbf/attachment.bin>


More information about the llvm-commits mailing list