[PATCH] D98489: [CodeGen] Fix backward copy propagation with -g
Zhiwei Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 12 04:05:56 PST 2021
condy created this revision.
Herald added subscribers: pengfei, hiraditya.
condy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Co-authored-by: condy <condy0919 at gmail.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98489
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: DBG_VALUE $rbp, $noreg
+ ; CHECK: 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: D98489.330203.patch
Type: text/x-patch
Size: 1535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/a4764371/attachment-0001.bin>
More information about the llvm-commits
mailing list