[PATCH] D69606: [MachineBasicBlock] Skip over debug instructions in computeRegisterLiveness before checking for begin/end.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 00:40:05 PDT 2019


craig.topper updated this revision to Diff 227037.
craig.topper added a comment.

Create the diff correctly. I forgot to commit the test case before running arcanist.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69606

Files:
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/test/CodeGen/X86/leaFixup64.mir


Index: llvm/test/CodeGen/X86/leaFixup64.mir
===================================================================
--- llvm/test/CodeGen/X86/leaFixup64.mir
+++ llvm/test/CodeGen/X86/leaFixup64.mir
@@ -1169,7 +1169,7 @@
     ; CHECK: NOOP
     ; CHECK: NOOP
     ; CHECK: NOOP
-    ; CHECK: $ebp = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg
+    ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags, implicit $rbp, implicit $rax
     ; CHECK: NOOP
     ; CHECK: NOOP
     ; CHECK: NOOP
Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
===================================================================
--- llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1406,6 +1406,10 @@
       return LQR_Dead;
   }
 
+  // Skip over debug instructions.
+  if (I != end() && I->isDebugInstr())
+    ++I;
+
   // If we reached the end, it is safe to clobber Reg at the end of a block of
   // no successor has it live in.
   if (I == end()) {
@@ -1462,6 +1466,11 @@
     } while (I != begin() && N > 0);
   }
 
+  // If all the instructions before this in the block are debug instructions,
+  // skip over them.
+  while (I != begin() && std::prev(I)->isDebugInstr())
+    --I;
+
   // Did we get to the start of the block?
   if (I == begin()) {
     // If so, the register's state is definitely defined by the live-in state.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69606.227037.patch
Type: text/x-patch
Size: 1354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191030/e498d7a4/attachment.bin>


More information about the llvm-commits mailing list