summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-07-11 13:30:27 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-07-11 13:30:27 +0000
commit0b492f7fb85ce8a2a5002e713fc1bf4e7940f427 (patch)
tree3445412aed9af04b07f78fd7e84b5a6d186b173d /llvm
parente523792a9c861c1a08796d25ac3ca33dbfe1a209 (diff)
downloadbcm5719-llvm-0b492f7fb85ce8a2a5002e713fc1bf4e7940f427.tar.gz
bcm5719-llvm-0b492f7fb85ce8a2a5002e713fc1bf4e7940f427.zip
[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. llvm-svn: 336803
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp2
-rw-r--r--llvm/test/CodeGen/X86/machine-cp-debug.mir23
2 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index d3bdc772ae4..3bf8147a06c 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -517,7 +517,7 @@ void MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
if (MO.isDef() && !MO.isEarlyClobber()) {
Defs.push_back(Reg);
continue;
- } else if (MO.readsReg())
+ } else if (!MO.isDebug() && MO.readsReg())
ReadRegister(Reg);
}
diff --git a/llvm/test/CodeGen/X86/machine-cp-debug.mir b/llvm/test/CodeGen/X86/machine-cp-debug.mir
new file mode 100644
index 00000000000..a7fcd9801e7
--- /dev/null
+++ b/llvm/test/CodeGen/X86/machine-cp-debug.mir
@@ -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
+...
OpenPOWER on IntegriCloud