[PATCH] D113116: [CodeGen] Fix assertion failure in TwoAddressInstructionPass::rescheduleMIBelowKill

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 9 01:24:55 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c3c7adf3a32: [CodeGen] Fix assertion failure in TwoAddressInstructionPass… (authored by foad).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113116

Files:
  llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  llvm/test/DebugInfo/MIR/X86/mlicm-hoist-post-regalloc.mir


Index: llvm/test/DebugInfo/MIR/X86/mlicm-hoist-post-regalloc.mir
===================================================================
--- llvm/test/DebugInfo/MIR/X86/mlicm-hoist-post-regalloc.mir
+++ llvm/test/DebugInfo/MIR/X86/mlicm-hoist-post-regalloc.mir
@@ -1,6 +1,7 @@
 --- |
   ; REQUIRES: asserts
   ; RUN: llc -start-before=phi-node-elimination -stop-after=machinelicm -debug-only=machinelicm -o - %s  | FileCheck %s
+  ; RUN: llc -start-before=phi-node-elimination -stop-after=machinelicm -debug-only=machinelicm -early-live-intervals -o - %s  | FileCheck %s
   ; Ensure we execute machinelicm post register allocation.
   ; Line numbers should not be retained when loop invariant instructions are hoisted.
   ;
Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
===================================================================
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -955,12 +955,13 @@
   nmi = End;
   MachineBasicBlock::iterator InsertPos = KillPos;
   if (LIS) {
-    // We have to move the copies first so that the MBB is still well-formed
-    // when calling handleMove().
+    // We have to move the copies (and any interleaved debug instructions)
+    // first so that the MBB is still well-formed when calling handleMove().
     for (MachineBasicBlock::iterator MBBI = AfterMI; MBBI != End;) {
       auto CopyMI = MBBI++;
       MBB->splice(InsertPos, MBB, CopyMI);
-      LIS->handleMove(*CopyMI);
+      if (!CopyMI->isDebugOrPseudoInstr())
+        LIS->handleMove(*CopyMI);
       InsertPos = CopyMI;
     }
     End = std::next(MachineBasicBlock::iterator(MI));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113116.385729.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/3dd6c654/attachment.bin>


More information about the llvm-commits mailing list