[PATCH] D98401: [CodeGen] Fix backward copy propagation with -g

Zhiwei Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 01:29:34 PDT 2021


condy updated this revision to Diff 330574.
condy added a comment.

CHECK-NEXT directive should be used


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98401

Files:
  llvm/lib/CodeGen/MachineCopyPropagation.cpp
  llvm/test/CodeGen/X86/machine-cp-clobbers.mir


Index: llvm/test/CodeGen/X86/machine-cp-clobbers.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/machine-cp-clobbers.mir
@@ -0,0 +1,17 @@
+# RUN: llc -mtriple=x86_64 -run-pass=machine-cp %s -o - | FileCheck %s
+
+---
+name: dont_clobber_register_in_dbg_value
+tracksRegLiveness: false
+body: |
+  bb.0:
+    ; CHECK-LABEL: name: dont_clobber_register_in_dbg_value
+    ; CHECK: renamable $rbx = LEA64r $rax, 1, $noreg, 8, $noreg
+    ; CHECK-NEXT: DBG_VALUE $rbp, $noreg
+    ; CHECK-NEXT: DBG_VALUE $noreg, $noreg
+    renamable $rbx = LEA64r $rax, 1, $noreg, 8, $noreg
+    DBG_VALUE $rbp, $noreg
+    renamable $rbx = COPY killed renamable $rbp
+    DBG_VALUE $noreg, $noreg
+
+...
Index: llvm/lib/CodeGen/MachineCopyPropagation.cpp
===================================================================
--- llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -648,6 +648,10 @@
       continue;
     }
 
+    // Ignore DBG_VALUEs and other meta infos
+    if (MI->isMetaInstruction())
+      continue;
+
     // Clobber any earlyclobber regs first.
     for (const MachineOperand &MO : MI->operands())
       if (MO.isReg() && MO.isEarlyClobber()) {
@@ -846,6 +850,10 @@
       }
     }
 
+    // Ignore DBG_VALUEs and other meta infos
+    if (MI->isMetaInstruction())
+      continue;
+
     // Invalidate any earlyclobber regs first.
     for (const MachineOperand &MO : MI->operands())
       if (MO.isReg() && MO.isEarlyClobber()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98401.330574.patch
Type: text/x-patch
Size: 1545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210315/8362b0f5/attachment.bin>


More information about the llvm-commits mailing list