[llvm] r336803 - [CodeGen] Ignore debug uses in MachineCopyPropagation
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 06:30:27 PDT 2018
Author: kparzysz
Date: Wed Jul 11 06:30:27 2018
New Revision: 336803
URL: http://llvm.org/viewvc/llvm-project?rev=336803&view=rev
Log:
[CodeGen] Ignore debug uses in MachineCopyPropagation
Debug uses should not count as real uses, since the presence of debug
information could affect the generated code.
Added:
llvm/trunk/test/CodeGen/X86/machine-cp-debug.mir
Modified:
llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp
Modified: llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp?rev=336803&r1=336802&r2=336803&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp Wed Jul 11 06:30:27 2018
@@ -517,7 +517,7 @@ void MachineCopyPropagation::CopyPropaga
if (MO.isDef() && !MO.isEarlyClobber()) {
Defs.push_back(Reg);
continue;
- } else if (MO.readsReg())
+ } else if (!MO.isDebug() && MO.readsReg())
ReadRegister(Reg);
}
Added: llvm/trunk/test/CodeGen/X86/machine-cp-debug.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-cp-debug.mir?rev=336803&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-cp-debug.mir (added)
+++ llvm/trunk/test/CodeGen/X86/machine-cp-debug.mir Wed Jul 11 06:30:27 2018
@@ -0,0 +1,23 @@
+# RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=machine-cp %s -o - | FileCheck %s
+
+# Machine copy propagation can remove dead copies. Make sure that the
+# DBG_VALUE does not keep the copy alive.
+#
+# CHECK-NOT: $ebx = COPY $eax
+
+--- |
+ define void @fred() {
+ ret void
+ }
+ !1 = !DIExpression()
+...
+
+---
+name: fred
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $eax
+ $ebx = COPY $eax
+ DBG_VALUE debug-use $ebx, debug-use _, !1, !1
+...
More information about the llvm-commits
mailing list